deqin -洞悉全局/预测未来


import numpy as np
import matplotlib.pyplot as plt
from sklearn import linear_model

# 怎么教电脑
# study: 4个标准  学习效率  做题用时  考试分数  运动时间
study = np.asarray([[0.9, 4, 90, 1], [0.6, 7, 70, 0.8], [0.5, 6, 73, 2], [0.999, 1, 100, 2]])
# 是否优秀 1 优秀 0 不优秀
if_good = np.asarray([[1], [0], [0], [1]])

yu_ce2 = np.asarray([[0.1, 10, 10, 0.34]])

# 逻辑模型
xun_lian_qi = linear_model.LogisticRegression()
xun_lian_qi.fit(study, if_good)
score = xun_lian_qi.score(study, if_good)
print(score)
yu_ce = xun_lian_qi.predict(yu_ce2)
print(yu_ce)







import numpy as np
import matplotlib.pyplot as plt
from sklearn import linear_model
# 怎么教电脑
age = np.asarray([[1], [3], [5], [7], [9], [12]])
high = np.asarray([[68], [86], [98], [119], [133], [151]])
yu_ce2 = np.asarray([[13], [4], [6], [8]])
xun_lian_qi = linear_model.LinearRegression()
xun_lian_qi.fit(age, high)
score = xun_lian_qi.score(age,high)
print(score)
yu_ce = xun_lian_qi.predict(yu_ce2)
plt.plot(age, high, "bo")
plt.plot(yu_ce2, yu_ce, "ro")
plt.xlabel("age")
plt.ylabel("high")
plt.show()

发布了613 篇原创文章 · 获赞 21 · 访问量 3万+

猜你喜欢

转载自blog.csdn.net/houlaos/article/details/105488803