Spaces:
Running
Running
Commit
·
fea02ec
1
Parent(s):
79b090a
Update Source/Predict/predict.py
Browse files
Source/Predict/predict.py
CHANGED
@@ -129,7 +129,7 @@ def get_one_week(team_name,season,week):
|
|
129 |
game[game.columns[4:]] = game[game.columns[4:]].expanding().mean()
|
130 |
game['TEAM'] = team_name
|
131 |
game['Season'] = season
|
132 |
-
return game.loc[game['GP']==week]
|
133 |
|
134 |
|
135 |
def get_one_week_home_and_away(home,away,season,week):
|
@@ -138,7 +138,7 @@ def get_one_week_home_and_away(home,away,season,week):
|
|
138 |
away.columns = [f'{i}.Away' for i in away.columns]
|
139 |
gbg = home.merge(away,left_index=True,right_index=True)
|
140 |
gbg.drop(columns=['TEAM','TEAM.Away','Season.Away','game_id.Away'], inplace=True)
|
141 |
-
return gbg
|
142 |
|
143 |
|
144 |
def predict(home,away,season,week,total):
|
@@ -147,7 +147,7 @@ def predict(home,away,season,week,total):
|
|
147 |
away_abbrev = team_name_to_abbreviation[away]
|
148 |
gbg = get_one_week_home_and_away(home_abbrev,away_abbrev,season,week)
|
149 |
gbg['Total Score Close'] = total
|
150 |
-
|
151 |
print(gbg)
|
152 |
matrix = xgb.DMatrix(gbg.drop(columns=['game_id','Season']).astype(float).values)
|
153 |
|
|
|
129 |
game[game.columns[4:]] = game[game.columns[4:]].expanding().mean()
|
130 |
game['TEAM'] = team_name
|
131 |
game['Season'] = season
|
132 |
+
return game.loc[game['GP']==week]
|
133 |
|
134 |
|
135 |
def get_one_week_home_and_away(home,away,season,week):
|
|
|
138 |
away.columns = [f'{i}.Away' for i in away.columns]
|
139 |
gbg = home.merge(away,left_index=True,right_index=True)
|
140 |
gbg.drop(columns=['TEAM','TEAM.Away','Season.Away','game_id.Away'], inplace=True)
|
141 |
+
return gbg.fillna(0)
|
142 |
|
143 |
|
144 |
def predict(home,away,season,week,total):
|
|
|
147 |
away_abbrev = team_name_to_abbreviation[away]
|
148 |
gbg = get_one_week_home_and_away(home_abbrev,away_abbrev,season,week)
|
149 |
gbg['Total Score Close'] = total
|
150 |
+
gbg['PassTD'] = 1000
|
151 |
print(gbg)
|
152 |
matrix = xgb.DMatrix(gbg.drop(columns=['game_id','Season']).astype(float).values)
|
153 |
|