-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpredict2.py
More file actions
65 lines (38 loc) · 1.1 KB
/
predict2.py
File metadata and controls
65 lines (38 loc) · 1.1 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import keras
import pandas as pd
from keras import backend as K
training = pd.read_csv("train.csv")
test = pd.read_csv("test.csv")
train = training.iloc[:,1:]
test = test.iloc[:,1:]
mean = train.mean(axis = 0)
train -= mean
std = train.std(axis = 0)
train /= std
test -= mean
test /= std
valid = train.iloc[13500:,:]
X_train = train.iloc[:,:6]
y_train = train.iloc[:,6:]
X_test = test.iloc[:,:6]
y_test = test.iloc[:,6:]
X_valid = valid.iloc[:,:6]
y_valid = valid.iloc[:,6:]
#def root_mean_squared_error(y_true, y_pred):
# return K.sqrt(K.mean(K.square(y_pred - y_true)))
#keras.utils.get_custom_objects().update({'root_mean_squared_error': root_mean_squared_error})
model = keras.models.load_model("Housing_MLP_5")
model.evaluate(X_test, y_test)
#model.predict(X_test[:1,:])
print(X_test.iloc[:1,:])
print(y_test.iloc[:1,:])
#print(model.predict(X_test.iloc[:1,:]))
mean = 206581.870283
std = 115096.397139
predict = model.predict(X_test.iloc[:1,:])
predict = predict * std
print(predict)
predict = predict + mean
print(predict)
print((0.3208 * std) + mean)
print((2.137496 * std) + mean)