import matplotlib.pyplot as plt
x = [[25], [27], [31], [33], [35]]
y = [[110], [115], [155], [160], [180]]
x_predict = [[11]]
plt.plot(x,y,'o')
plt.show()
from sklearn import linear_model
# 新建一个模型训练对象
model = linear_model.LinearRegression()
# 训练数据
model.fit(x, y)
# 预测
predicted = model.predict(x_predict)
print(predicted)
# 概率
score = model.score(x,y)
print(score)
import requests
import easygui
# 图灵 计算机之父
for i in range(10):
x = input('我说:')
url = "http://www.tuling123.com/openapi/api?key=d8dee202a87940bd866332938dd9ec52&info=%s"%x
response = requests.get(url)
print("电脑说:",end="")
print(response.json()["text"])
runze - 机器学习
最新推荐文章于 2024-02-23 17:45:27 发布