如何将线性回归线添加到此散点图?

2024-05-13 20:24:20 发布

您现在位置:Python中文网/ 问答频道 /正文

如何将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()

Tags: in模型testdatamodel线性openml