【发布时间】:2020-11-02 14:41:31
【问题描述】:
我使用 Python 的 Keras 包构建了一个神经网络。我的网络的目标是预测房价。这是我的训练数据集的样子。
Price Beds SqFt Built Garage FullBaths HalfBaths LotSqFt
485000 3 2336 2004 2 2.0 1.0 2178.0
430000 4 2106 2005 2 2.0 1.0 2178.0
445000 3 1410 1999 1 2.0 0.0 3049.0
...
假设我有一些新房子要分析。例如,我想用
预测房子的价格- 4 张床
- 2500 平方英尺
- 2001 年建成
- 3 个全套卫浴
- 1 半浴
- 3452 平方英尺的地段
如何将这些值输入到我的网络中以接收预测价格。另外,有没有办法让网络报告某种置信度指标?
作为参考,这是我的网络当前的样子。
from keras.models import Sequential
from keras.layers import Dense
N = 16
model = Sequential([
Dense(N, activation='relu', input_shape=(7,)),
Dense(1, activation='relu'),
])
model.compile(optimizer='sgd',
loss='mse',
metrics=['mean_squared_error'])
hist = model.fit(X_train, Y_train,
batch_size=32, epochs=100,
validation_data=(X_val, Y_val))
model.evaluate(X_test, Y_test)[1]
提前致谢!!
【问题讨论】:
标签: python tensorflow keras neural-network prediction