-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpredict.py
More file actions
39 lines (32 loc) · 1.38 KB
/
predict.py
File metadata and controls
39 lines (32 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from sklearn.neighbors import KNeighborsClassifier
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import LabelEncoder
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import LinearRegression
from sklearn.metrics import mean_squared_error
from keras.utils import to_categorical
from keras.models import Sequential
from keras.layers import Dense
from keras.backend import clear_session
import matplotlib.pyplot as plt
import pandas as pd
import os
import warnings
warnings.simplefilter('ignore')
import numpy as np
import pickle
def prediction_lin(Property_Code1, p2,p3,p4, Bedrooms, Bathrooms,SQFT):
#import pickled model
trained_model_lin = pickle.load(open('models/linear_model.pkl','rb'))
# Make prediction from the loaded model
predict_lin = trained_model_lin.predict([[Property_Code1,p2,p3,p4,Bedrooms,Bathrooms,SQFT]])
#result_lin="${:,.2f}".format(predict_lin)
return round(predict_lin[0][0],2)
def prediction_log(Property_Code1, p2,p3,p4, Bedrooms, Bathrooms,SQFT,Rent):
#import pickled model
list_pickle = open('models/logisitic_depp_network.pkl','rb')
trained_model_log = pickle.load(list_pickle)
# Make prediction from the loaded model
predict_log = trained_model_log.predict_classes([[[SQFT,Bedrooms,Bathrooms,Rent,Property_Code1, p2,p3,p4]]])
clear_session()
return predict_log