def plot2dRegression(x,y, nameX, nameY, namePlot):
model = LinearRegression()
linearModel = model.fit(x, y)
predictModel = linearModel.predict(x)
plt.scatter(x,y, color='g')
plt.plot(x, predictModel, color='k')
plt.xlabel(nameX)
plt.ylabel(nameY)
test = stats.linregress(predictModel,y)
print("The squared of the correlation coefficient R^2 is " + str(test.rvalue**2))
plt.savefig("plot/loadings/"+namePlot, bbox_inches='tight')
plt.show()
return test.rvalue**2
#plot the 2D regression between the performance values and the loadings.
#return the correlation factor: R squared
representation.py 文件源码
python
阅读 32
收藏 0
点赞 0
评论 0
评论列表
文章目录