【发布时间】:2020-04-13 00:50:14
【问题描述】:
如何将ML模型生成的线性回归线添加到散点图中?
pickle_in=open("student-model.pickle","rb")
linear=pickle.load(pickle_in)
acc=linear.score(x_test, y_test)
print(f"accuracy= {round(acc*100,2)}%")
#comment: for scatter plot
style.use("ggplot")
p="G1"
pyplot.scatter(data[p],data["G3"])
pyplot.xlabel(p)
pyplot.ylabel("Final Grade")
pyplot.show()
【问题讨论】:
-
演出前可以说
pyplot.plot(x,y) -
由于您似乎是 Stack Overflow 的新手,您应该阅读How to create a Minimal, Complete, and Verifiable example
标签: python matplotlib linear-regression