feat: 增加jcbf和sk_test
This commit is contained in:
parent
fe99068e85
commit
7928980720
|
|
@ -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"]
|
||||
|
|
@ -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)
|
||||
Loading…
Reference in New Issue