我对整个话题都很陌生,所以请不要苛刻。我知道这些可能是简单的问题,但每个人都必须从某个地方开始^^
所以我创建了(或更多复制)我的第一个小模型,它根据他们的父亲预测儿子的身高。
#Father Data
X=data['Father'].values[:,None]
X.shape
#According sons data
y=data.iloc[:,1].values
y.shape
#Spliting the data into test and train data
X_train,X_test,y_train,y_test=train_test_split(X,y,test_size=0.2,random_state=0)
#Doing a linear regression
lm=LinearRegression()
lm.fit(X_train,y_train)
# save the model to disk
filename = 'Father_Son_Height_Model.pckl'
pickle.dump(lm, open(filename, 'wb'))
#Predicting the height of Sons
y_test=lm.predict(X_test)
print(y_test)
现在我想创建一个图来显示我的模型的准确性或它有多“好”。类似的事情在这里完成: https ://machinelearningmastery.com/how-to-calculate-precision-recall-f1-and-more-for-deep-learning-models/
但我不能安静地让它工作。这似乎我会工作,但我应该在“model_history”中存储什么?
plt.subplot(212)
plt.title('Accuracy')
plt.plot(model_history.history['acc'], label='train')
plt.plot(model_history.history['val_acc'], label='test')
plt.legend()
plt.show()
一个易于适应的教程链接已经是一个很好的帮助。Keras 似乎是一件事,但如果可能且明智的话,我想避免使用另一个库。
