Spaces:
Running
Running
BraydenMoore
commited on
Commit
β’
50d0917
1
Parent(s):
235fd2c
Delete unnecessary notebooks
Browse files- Notebook Three.ipynb +0 -114
- Notebook Too.ipynb +0 -0
- Notebook.ipynb +0 -0
Notebook Three.ipynb
DELETED
@@ -1,114 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"cells": [
|
3 |
-
{
|
4 |
-
"cell_type": "code",
|
5 |
-
"execution_count": 1,
|
6 |
-
"metadata": {},
|
7 |
-
"outputs": [],
|
8 |
-
"source": [
|
9 |
-
"import pandas as pd\n",
|
10 |
-
"gbg_and_odds_this_year = pd.read_csv('Source/Data/gbg_and_odds_this_year.csv')\n",
|
11 |
-
"results = pd.read_csv('Source/Data/results.csv')\n",
|
12 |
-
"\n",
|
13 |
-
"from Source.Predict.predict import predict"
|
14 |
-
]
|
15 |
-
},
|
16 |
-
{
|
17 |
-
"cell_type": "code",
|
18 |
-
"execution_count": 2,
|
19 |
-
"metadata": {},
|
20 |
-
"outputs": [],
|
21 |
-
"source": [
|
22 |
-
"import pickle as pkl\n",
|
23 |
-
"with open('Source/Pickles/team_abbreviation_to_name.pkl', 'rb') as f:\n",
|
24 |
-
" team_abbreviation_to_name = pkl.load(f)"
|
25 |
-
]
|
26 |
-
},
|
27 |
-
{
|
28 |
-
"cell_type": "code",
|
29 |
-
"execution_count": 4,
|
30 |
-
"metadata": {},
|
31 |
-
"outputs": [
|
32 |
-
{
|
33 |
-
"name": "stderr",
|
34 |
-
"output_type": "stream",
|
35 |
-
"text": [
|
36 |
-
"100%|ββββββββββ| 32/32 [00:04<00:00, 6.79it/s]\n"
|
37 |
-
]
|
38 |
-
}
|
39 |
-
],
|
40 |
-
"source": [
|
41 |
-
"from tqdm import tqdm\n",
|
42 |
-
"predictions = {}\n",
|
43 |
-
"for game_id,home,away,season,week,total in tqdm(gbg_and_odds_this_year[['game_id','home_team','away_team','Season','GP','Total Score Close']].values):\n",
|
44 |
-
" if week!=1:\n",
|
45 |
-
" predictions[game_id] = predict(home,away,season,week,total)"
|
46 |
-
]
|
47 |
-
},
|
48 |
-
{
|
49 |
-
"cell_type": "code",
|
50 |
-
"execution_count": 8,
|
51 |
-
"metadata": {},
|
52 |
-
"outputs": [
|
53 |
-
{
|
54 |
-
"name": "stdout",
|
55 |
-
"output_type": "stream",
|
56 |
-
"text": [
|
57 |
-
"{'winners_correct': '5', 'winners_incorrect': '11', 'over_unders_correct': '7', 'over_unders_incorrect': '9'}\n"
|
58 |
-
]
|
59 |
-
}
|
60 |
-
],
|
61 |
-
"source": [
|
62 |
-
"predictions_df = pd.DataFrame(predictions).T\n",
|
63 |
-
"predictions_df['predicted_winner'] = [i['Winner'][0] if type(i['Winner'])==list else None for i in predictions_df[1]]\n",
|
64 |
-
"predictions_df['predicted_winner'] = predictions_df['predicted_winner'].map(team_abbreviation_to_name)\n",
|
65 |
-
"predictions_df['predicted_over_under'] = [i['Over/Under'][0] if type(i['Over/Under'])==list else None for i in predictions_df[2]]\n",
|
66 |
-
"predictions_df = predictions_df.merge(results, left_index=True, right_on='game_id').merge(gbg_and_odds_this_year[['game_id','Total Score Close']]).dropna(subset=['predicted_winner'])\n",
|
67 |
-
"predictions_df['over_under'] = ['Over' if t>tsc else 'Under' if t<tsc else 'Push' for t,tsc in predictions_df[['total','Total Score Close']].values]\n",
|
68 |
-
"\n",
|
69 |
-
"predictions_df['winner_correct'] = (predictions_df['predicted_winner']==predictions_df['winner']).astype(int)\n",
|
70 |
-
"predictions_df['winner_incorrect'] = (predictions_df['predicted_winner']!=predictions_df['winner']).astype(int)\n",
|
71 |
-
"\n",
|
72 |
-
"predictions_df['over_under_correct'] = (predictions_df['predicted_over_under']==predictions_df['over_under']).astype(int)\n",
|
73 |
-
"predictions_df['over_under_incorrect'] = (predictions_df['predicted_over_under']!=predictions_df['over_under']).astype(int)\n",
|
74 |
-
"\n",
|
75 |
-
"winners_correct = predictions_df['winner_correct'].sum()\n",
|
76 |
-
"winners_incorrect = predictions_df['winner_incorrect'].sum()\n",
|
77 |
-
"\n",
|
78 |
-
"over_unders_correct = predictions_df['over_under_correct'].sum()\n",
|
79 |
-
"over_unders_incorrect = predictions_df['over_under_incorrect'].sum()\n",
|
80 |
-
"\n",
|
81 |
-
"record = {\"winners_correct\":str(winners_correct),\n",
|
82 |
-
" \"winners_incorrect\":str(winners_incorrect),\n",
|
83 |
-
" \"over_unders_correct\":str(over_unders_correct),\n",
|
84 |
-
" \"over_unders_incorrect\":str(over_unders_incorrect)}\n",
|
85 |
-
"\n",
|
86 |
-
"import json\n",
|
87 |
-
"with open('Static/record.json', 'w') as f:\n",
|
88 |
-
" json.dump(record,f)"
|
89 |
-
]
|
90 |
-
}
|
91 |
-
],
|
92 |
-
"metadata": {
|
93 |
-
"kernelspec": {
|
94 |
-
"display_name": "Python 3",
|
95 |
-
"language": "python",
|
96 |
-
"name": "python3"
|
97 |
-
},
|
98 |
-
"language_info": {
|
99 |
-
"codemirror_mode": {
|
100 |
-
"name": "ipython",
|
101 |
-
"version": 3
|
102 |
-
},
|
103 |
-
"file_extension": ".py",
|
104 |
-
"mimetype": "text/x-python",
|
105 |
-
"name": "python",
|
106 |
-
"nbconvert_exporter": "python",
|
107 |
-
"pygments_lexer": "ipython3",
|
108 |
-
"version": "3.10.4"
|
109 |
-
},
|
110 |
-
"orig_nbformat": 4
|
111 |
-
},
|
112 |
-
"nbformat": 4,
|
113 |
-
"nbformat_minor": 2
|
114 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Notebook Too.ipynb
DELETED
The diff for this file is too large to render.
See raw diff
|
|
Notebook.ipynb
DELETED
The diff for this file is too large to render.
See raw diff
|
|