Question

Iam pretty new to the whole topic so please dont be harsh. I know these may be simple questions but everybody has to start somewhere ^^

So I created (or more copied) my first little Model which predicts sons heights based on their fathers.

#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)

Now I wanted to create a plot that displays the accuracy of my model or how "good" it is. Something like it is done here: https://machinelearningmastery.com/how-to-calculate-precision-recall-f1-and-more-for-deep-learning-models/

But i cant quiet get it to work. This here Sems like I would work but what should I store in "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()

A easy to adapt tutorial-Link would be a geat help already. Keras seems to be a thing but I would want to avoid yet another library if possible and sensible.

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with datascience.stackexchange
scroll top