I have just trained a linear regression model, getting my intercept and coefficient for house prices based on the "number_rooms" and "price". But I am just a bit unsure on how to plot my regression model using a scatter plot with a line of best fit.
Any help would be much appreciated on how to do this - thanks!
Here's my code:
rgr = linear_model.LinearRegression()
rgr.fit(X=sample['number_rooms'].values.reshape(-1,1), y=sample['price'].values)
print(rgr.intercept_, rgr.coef_[0])
predictions = rgr.predict(X=sample['number_rooms'].values.reshape(-1,1))
metrics.mean_squared_error(y_pred=predictions, y_true=sample['price'], squared=False)