From 7928980720169aa36a7166f21d1480a76942f4ae Mon Sep 17 00:00:00 2001 From: chenwj113 Date: Fri, 11 Nov 2022 11:51:27 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0jcbf=E5=92=8Csk=5Ftes?= =?UTF-8?q?t?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jcbf.py | 23 +++++++++++++++++++++++ sk_test.py | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 jcbf.py create mode 100644 sk_test.py diff --git a/jcbf.py b/jcbf.py new file mode 100644 index 0000000..10f3e8c --- /dev/null +++ b/jcbf.py @@ -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"] \ No newline at end of file diff --git a/sk_test.py b/sk_test.py new file mode 100644 index 0000000..712ebbd --- /dev/null +++ b/sk_test.py @@ -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)