BraydenMoore commited on
Commit
7e8b063
2 Parent(s): c8cf1db a1fa974

Resolving conflicts

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. Notebook Three.ipynb +114 -0
  2. Notebook Too.ipynb +0 -0
  3. Notebook.ipynb +0 -0
  4. Source/Data/gbg_and_odds_this_year.csv +2 -2
  5. Source/Data/gbg_this_year.csv +2 -2
  6. Source/Models/xgboost_ML_no_odds_56.8%.json +0 -0
  7. Source/Models/xgboost_ML_no_odds_60.8%.json +0 -0
  8. Source/Models/xgboost_ML_no_odds_61.3%.json +0 -0
  9. Source/Models/xgboost_ML_no_odds_62.3%.json +0 -0
  10. Source/Models/xgboost_ML_no_odds_63.3%.json +0 -0
  11. Source/Models/xgboost_ML_no_odds_63.8%.json +0 -0
  12. Source/Models/xgboost_ML_no_odds_64.3%.json +0 -0
  13. Source/Models/xgboost_ML_no_odds_64.8%.json +0 -0
  14. Source/Models/xgboost_ML_no_odds_66.3%.json +0 -0
  15. Source/Models/xgboost_ML_no_odds_66.8%.json +0 -0
  16. Source/Models/xgboost_ML_no_odds_68.8%.json +0 -0
  17. Source/Models/xgboost_ML_no_odds_69.3%.json +0 -0
  18. Source/Models/xgboost_ML_no_odds_70.4%.json +0 -0
  19. Source/Models/xgboost_OU_no_odds_51.8%.json +0 -0
  20. Source/Models/xgboost_OU_no_odds_53.3%.json +0 -0
  21. Source/Models/xgboost_OU_no_odds_55.8%.json +0 -0
  22. Source/Pickles/test_games_ML_no_odds_56.8%.pkl +3 -0
  23. Source/Pickles/test_games_ML_no_odds_60.8%.pkl +3 -0
  24. Source/Pickles/test_games_ML_no_odds_61.3%.pkl +3 -0
  25. Source/Pickles/test_games_ML_no_odds_62.3%.pkl +3 -0
  26. Source/Pickles/test_games_ML_no_odds_63.3%.pkl +3 -0
  27. Source/Pickles/test_games_ML_no_odds_63.8%.pkl +3 -0
  28. Source/Pickles/test_games_ML_no_odds_64.3%.pkl +3 -0
  29. Source/Pickles/test_games_ML_no_odds_64.8%.pkl +3 -0
  30. Source/Pickles/test_games_ML_no_odds_66.3%.pkl +3 -0
  31. Source/Pickles/test_games_ML_no_odds_66.8%.pkl +3 -0
  32. Source/Pickles/test_games_ML_no_odds_68.8%.pkl +3 -0
  33. Source/Pickles/test_games_ML_no_odds_69.3%.pkl +3 -0
  34. Source/Pickles/test_games_ML_no_odds_70.4%.pkl +3 -0
  35. Source/Pickles/train_games_ML_no_odds_56.8%.pkl +3 -0
  36. Source/Pickles/train_games_ML_no_odds_60.8%.pkl +3 -0
  37. Source/Pickles/train_games_ML_no_odds_61.3%.pkl +3 -0
  38. Source/Pickles/train_games_ML_no_odds_62.3%.pkl +3 -0
  39. Source/Pickles/train_games_ML_no_odds_63.3%.pkl +3 -0
  40. Source/Pickles/train_games_ML_no_odds_63.8%.pkl +3 -0
  41. Source/Pickles/train_games_ML_no_odds_64.3%.pkl +3 -0
  42. Source/Pickles/train_games_ML_no_odds_64.8%.pkl +3 -0
  43. Source/Pickles/train_games_ML_no_odds_66.3%.pkl +3 -0
  44. Source/Pickles/train_games_ML_no_odds_66.8%.pkl +3 -0
  45. Source/Pickles/train_games_ML_no_odds_68.8%.pkl +3 -0
  46. Source/Pickles/train_games_ML_no_odds_69.3%.pkl +3 -0
  47. Source/Pickles/train_games_ML_no_odds_70.4%.pkl +3 -0
  48. Source/Predict/__pycache__/predict.cpython-311.pyc +0 -0
  49. Source/Test/xgboost_ATS.py +73 -0
  50. Source/Test/xgboost_ATS_no_odds_55.3%_dark.png +0 -0
Notebook Three.ipynb ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 ADDED
The diff for this file is too large to render. See raw diff
 
Notebook.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
Source/Data/gbg_and_odds_this_year.csv CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:50b3b58f86136e21b5f840f9662fe345978d02b9b3a405b2b36b9bd0092f4b5c
3
- size 27668
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1234f3e9ad2354b7b8afecc8e1707619aa410604355eeebe81deb94b6004939f
3
+ size 247
Source/Data/gbg_this_year.csv CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:e84c713bd6186f61e03ef4a77221b21e4d3da826cdb1072efc9aa03da28cf6ff
3
- size 24329
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d0a700bf31c8b720abde453ea86cd6a62b2fde560181d5ba236d6f3f8727bd63
3
+ size 247
Source/Models/xgboost_ML_no_odds_56.8%.json ADDED
The diff for this file is too large to render. See raw diff
 
Source/Models/xgboost_ML_no_odds_60.8%.json ADDED
The diff for this file is too large to render. See raw diff
 
Source/Models/xgboost_ML_no_odds_61.3%.json ADDED
The diff for this file is too large to render. See raw diff
 
Source/Models/xgboost_ML_no_odds_62.3%.json ADDED
The diff for this file is too large to render. See raw diff
 
Source/Models/xgboost_ML_no_odds_63.3%.json ADDED
The diff for this file is too large to render. See raw diff
 
Source/Models/xgboost_ML_no_odds_63.8%.json ADDED
The diff for this file is too large to render. See raw diff
 
Source/Models/xgboost_ML_no_odds_64.3%.json ADDED
The diff for this file is too large to render. See raw diff
 
Source/Models/xgboost_ML_no_odds_64.8%.json ADDED
The diff for this file is too large to render. See raw diff
 
Source/Models/xgboost_ML_no_odds_66.3%.json ADDED
The diff for this file is too large to render. See raw diff
 
Source/Models/xgboost_ML_no_odds_66.8%.json ADDED
The diff for this file is too large to render. See raw diff
 
Source/Models/xgboost_ML_no_odds_68.8%.json ADDED
The diff for this file is too large to render. See raw diff
 
Source/Models/xgboost_ML_no_odds_69.3%.json ADDED
The diff for this file is too large to render. See raw diff
 
Source/Models/xgboost_ML_no_odds_70.4%.json ADDED
The diff for this file is too large to render. See raw diff
 
Source/Models/xgboost_OU_no_odds_51.8%.json ADDED
The diff for this file is too large to render. See raw diff
 
Source/Models/xgboost_OU_no_odds_53.3%.json ADDED
The diff for this file is too large to render. See raw diff
 
Source/Models/xgboost_OU_no_odds_55.8%.json ADDED
The diff for this file is too large to render. See raw diff
 
Source/Pickles/test_games_ML_no_odds_56.8%.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e9de8a504027d57618d4da8109650fe8b9066ed6004e219d438919adb5366948
3
+ size 7350
Source/Pickles/test_games_ML_no_odds_60.8%.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5a5999fb7ed12aa5b2ade24d141d63e9963ae15eded24d1c8aea090367559ed3
3
+ size 7350
Source/Pickles/test_games_ML_no_odds_61.3%.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1094d3f1609339f5f7bd4fc3ee06d486d6f91c019e350faec3f8480442e6c49c
3
+ size 7367
Source/Pickles/test_games_ML_no_odds_62.3%.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1e2e727ea400cff2e1b2aac127eb941a520428845d3c0a00e1790eff0428b3f7
3
+ size 7356
Source/Pickles/test_games_ML_no_odds_63.3%.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a6ca43f09db56c85998c4b8b70574de4905d1b36171cc50253edafa44510cd05
3
+ size 7348
Source/Pickles/test_games_ML_no_odds_63.8%.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:57aa95eaf063191a73111e722d1ea26d9011d4fe01fb78c3b416a44c7af4f0c8
3
+ size 7365
Source/Pickles/test_games_ML_no_odds_64.3%.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e29727442b17d1d45f8c7f4ac48618e81c2bdbd27b0a3be4f588c86ec7876c0c
3
+ size 7363
Source/Pickles/test_games_ML_no_odds_64.8%.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:96f9ed4af90c558a539e17899a69cfde4ff53e37565178cc81e80c16993a1fed
3
+ size 7375
Source/Pickles/test_games_ML_no_odds_66.3%.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3342df137a7a867d4903304fc488a3e9114b5dadd0395a1c9e826faba46b14dd
3
+ size 7372
Source/Pickles/test_games_ML_no_odds_66.8%.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ba3bc038ddb5c55765db6826a3ee66900acdb1af4485fffacbf75cf0a20775e0
3
+ size 7363
Source/Pickles/test_games_ML_no_odds_68.8%.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:21c52f6d5555abbe81afb8eb5ce51314db8fdaa027e0681995f72d035bdb3fa0
3
+ size 7348
Source/Pickles/test_games_ML_no_odds_69.3%.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4f3651e693c61284b625ce62aaf513868f8c6659d0cf74306c88a113f482732b
3
+ size 7382
Source/Pickles/test_games_ML_no_odds_70.4%.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4d6ff524f255f3f0b991d5843e62f3a61c9098a342f1e70409241c3fd48591e7
3
+ size 7359
Source/Pickles/train_games_ML_no_odds_56.8%.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ca8a6032d9b8cab82d8c3501a9d28eeee3a5842ec459930d2405341495b1eaa2
3
+ size 60523
Source/Pickles/train_games_ML_no_odds_60.8%.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6c063b87bbefd7d7ea0634e3eca8ce793b17bea8a5fd192198e67ca473166a75
3
+ size 60523
Source/Pickles/train_games_ML_no_odds_61.3%.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d25e3782278fb3c0633dfd0e07d2aa0d25fe0b05aa6c49168eea5947931120a1
3
+ size 60506
Source/Pickles/train_games_ML_no_odds_62.3%.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4daebfa530c6cbc6eb4629dcb65a33fa18e9d73207a3e38d7d2e9392d70b6591
3
+ size 60517
Source/Pickles/train_games_ML_no_odds_63.3%.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b4b35d4f876e6c8481d6be95ed318e202988cd06afbbaf0070093b51f9d9bec3
3
+ size 60525
Source/Pickles/train_games_ML_no_odds_63.8%.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:743d69e1f23c42a1e8bf367c763a44d7d42fd9567ed91b0c349bf7afea0dc04b
3
+ size 60508
Source/Pickles/train_games_ML_no_odds_64.3%.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a7814ae36312d3976155ddd6084549aca8e896426be9ad1ab9eed281030f3d35
3
+ size 60510
Source/Pickles/train_games_ML_no_odds_64.8%.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3b27c94d1eeef7685b02d1313d96e8dce2fb0eb1dc6124f89a8b28a63677a1b8
3
+ size 60498
Source/Pickles/train_games_ML_no_odds_66.3%.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:874e5ccf89ef68d5ac89aa2296d3870bb4f66b3056d81380a3dccaa090a033ea
3
+ size 60501
Source/Pickles/train_games_ML_no_odds_66.8%.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:53ca1cc66cd499320f1877115b9b0d69b33f326cd440ce460a15ecd76a2a78b7
3
+ size 60510
Source/Pickles/train_games_ML_no_odds_68.8%.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3cdfc6a958cffb0503834506cd5693b6d330141a689f87f7e9eee3a407724653
3
+ size 60525
Source/Pickles/train_games_ML_no_odds_69.3%.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:764b3f6d73f6af54d20cb55d57afd2e914c6030dfe9a5ef9a2914cb59169a2a3
3
+ size 60491
Source/Pickles/train_games_ML_no_odds_70.4%.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:645a7f423a9ff0db4c037e3fbc0f6fa36b0c763ee70223f634889d0ee19412f5
3
+ size 60514
Source/Predict/__pycache__/predict.cpython-311.pyc CHANGED
Binary files a/Source/Predict/__pycache__/predict.cpython-311.pyc and b/Source/Predict/__pycache__/predict.cpython-311.pyc differ
 
Source/Test/xgboost_ATS.py ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from cgi import test
2
+ import xgboost as xgb
3
+ import pandas as pd
4
+ import pickle as pkl
5
+ import numpy as np
6
+ import os
7
+
8
+ model = 'xgboost_ATS_no_odds_57.3%'
9
+
10
+ current_directory = os.path.dirname(os.path.abspath(__file__))
11
+ parent_directory = os.path.dirname(current_directory)
12
+ data_directory = os.path.join(parent_directory, 'Data')
13
+ model_directory = os.path.join(parent_directory, 'Models')
14
+ pickle_directory = os.path.join(parent_directory, 'Pickles')
15
+
16
+ file_path = os.path.join(model_directory, f'{model}.json')
17
+ xgb_ml = xgb.Booster()
18
+ xgb_ml.load_model(file_path)
19
+
20
+ file_path = os.path.join(pickle_directory, 'test_games_ATS_no_odds.pkl')
21
+ with open(file_path,'rb') as f:
22
+ test_games = pkl.load(f).tolist()
23
+
24
+ file_path = os.path.join(data_directory, 'gbg_and_odds.csv')
25
+ gbg_and_odds = pd.read_csv(file_path)
26
+ test_data = gbg_and_odds.loc[gbg_and_odds['game_id'].isin(test_games)]
27
+ test_data_matrix = xgb.DMatrix(test_data.drop(columns=['game_id','Home-Team-Win','Home-Team-Cover','Over','Season','home_team','away_team','game_date','Key','Home Score','Away Score','Home Odds Close','Away Odds Close','Home Winnings','Away Winnings','Away Odds','Home Odds']).astype(float).values)
28
+
29
+ predicted_probas = xgb_ml.predict(test_data_matrix)
30
+ predictions = np.argmax(predicted_probas, axis=1)
31
+ test_data['predicted_proba'] = [i[1] for i in predicted_probas]
32
+ test_data['prediction'] = predictions
33
+ test_data['correct'] = test_data['Home-Team-Cover']==test_data['prediction']
34
+ print(test_data['predicted_proba'])
35
+ print(test_data['correct'].mean())
36
+
37
+ bets = test_data.loc[(test_data['predicted_proba']>0.5) | (test_data['predicted_proba']<0.5)]
38
+ bets['winnings'] = [0.91 if c==1 else -1 for c in bets['correct']]
39
+
40
+ print('Actual')
41
+ print(bets.loc[bets['Home-Team-Cover']==1].shape)
42
+ print(bets.loc[bets['Home-Team-Cover']==0].shape)
43
+ print(bets.loc[bets['Home-Team-Cover']==2].shape)
44
+
45
+ print('Predicted')
46
+ print(bets.loc[bets['prediction']==1].shape)
47
+ print(bets.loc[bets['prediction']==0].shape)
48
+ print(bets.loc[bets['prediction']==2].shape)
49
+
50
+
51
+ import matplotlib.pyplot as plt
52
+ fig = plt.figure(facecolor='black')
53
+ ax = fig.add_subplot(1, 1, 1, facecolor='black')
54
+
55
+ # Plot data with line color as RGB(0, 128, 0)
56
+ ax.plot(bets['winnings'].cumsum().values*100, linewidth=3, color=(0/255, 128/255, 0/255))
57
+
58
+ # Set title and labels
59
+ ax.set_title('MARCI 3.0 - Against the Spread', color='white')
60
+ ax.set_xlabel('Games Bet On', color='white')
61
+ ax.set_ylabel('Return (%)', color='white')
62
+
63
+ # Change tick colors to white
64
+ ax.tick_params(axis='x', colors='white')
65
+ ax.tick_params(axis='y', colors='white')
66
+
67
+ # Change axis edge colors
68
+ ax.spines['bottom'].set_color('white')
69
+ ax.spines['top'].set_color('white')
70
+ ax.spines['left'].set_color('white')
71
+ ax.spines['right'].set_color('white')
72
+
73
+ plt.savefig(f'{model}_dark.png', facecolor='black')
Source/Test/xgboost_ATS_no_odds_55.3%_dark.png ADDED