首页 > 其他 > 详细

7_useful_pandas_code

时间:2020-02-24 21:52:55      阅读:83      评论:0      收藏:0      [点我收藏+]
# plot the numerical columns vs the output SalePrice to visualise the (linear) relationship

for col in cols_to_use[:-1]:
    data.plot.scatter(x=col, y=SalePrice, ylim=(0,800000))
    plt.show()
col = OverallQual
linreg = LinearRegression()
linreg.fit(X_train[col].to_frame(), y_train)
print(Train set)
pred = linreg.predict(X_train[col].to_frame())
print(Linear Regression mse: {}.format(mean_squared_error(y_train, pred)))
print(Test set)
pred = linreg.predict(X_test[col].to_frame())
print(Linear Regression mse: {}.format(mean_squared_error(y_test, pred)))
print()
X_test[error] = X_test.SalePrice - pred
print(Error Stats)
print(X_test[error].describe())
X_test.plot.scatter(x=col, y=error)

 

7_useful_pandas_code

原文:https://www.cnblogs.com/ziwh666/p/12358880.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!