|||
def linear_model_main(xx,yy):
regr = linear_model.LinearRegression()
regr.fit(xx,yy)
predictions = {}
predictions['intercept'] = regr.intercept_ #截距
predictions['coefficient'] = regr.coef_ #系数
predictions['predicted_values'] = regr.predict(xx) #预测值
predictions['corrcoef'] = np.corrcoef(xx,yy) #相关系数
return predictions
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-11-1 07:25
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社