feat: 增加jcbf和sk_test

This commit is contained in:
chenwj113 2022-11-11 11:51:27 +08:00
parent fe99068e85
commit 7928980720
2 changed files with 57 additions and 0 deletions

23
jcbf.py Normal file
View File

@ -0,0 +1,23 @@
import requests
from furl import furl
import time
import json
file = open("data.json", "w+")
base_url = "https://www.ttyingqiu.com/"
f = furl(base_url)
f.path = "/static/no_cache/league/zc/jsbf/ttyq2020/jsbf_2022-11-06.json"
f.args["v"] = int(time.time()*1000)
print(f.url)
print(r.status_code)
print(r.json())
file.write(json.dumps(r.json()))
file.close()
url = "/static/no_cache/league/zc/jsbf/ttyq2020/jczq/jsbf_2022-11-06.json?v=1667799791084"
url = "https://www.ttyingqiu.com/static/no_cache/league/zc/jsbf/ttyq2020/jczq/2022-11-06/oz_407_6.json?v=1667799791169"
match_list = data["matchList"]

34
sk_test.py Normal file
View File

@ -0,0 +1,34 @@
import sklearn
from sklearn import linear_model, tree
# 普通最小二乘法
reg = linear_model.LinearRegression()
reg.fit([[0, 0], [1, 1], [2, 2]], [0, 1, 2])
result = reg.predict([[3, 1]])
print(reg.coef_)
print(result)
# 贝叶斯岭回归
X = [[0., 0.], [1., 1.], [2., 2.], [3., 3.]]
Y = [0., 1., 2., 3.]
reg = linear_model.BayesianRidge()
reg.fit(X, Y)
result = reg.predict([[1, 0]])
print(reg.coef_)
print(result)
# 决策树分类
X = [[0, 0], [1, 1]]
Y = [0, 1]
clf = tree.DecisionTreeClassifier()
clf = clf.fit(X, Y)
result = clf.predict([[10., 11.]])
print(result)
print(clf.predict_proba([[10., 11.]]))
# 决策树回归
X = [[0, 0], [2, 2]]
Y = [1.5, 6.5]
clf = tree.DecisionTreeRegressor()
clf = clf.fit(X, Y)
result = clf.predict([[1, 2]])
print(result)