morelandjs / melo

Margin-dependent Elo ratings and predictions
https://moreland.dev/projects/melo
MIT License
15 stars 1 forks source link

How to handle only positive spreads #1

Open Anjum48 opened 4 years ago

Anjum48 commented 4 years ago

I have some basketball data in this format:

image

Where WTeamID is always the winning team, meaning that the spread is always > 0. What's the best way of using Melo for this type of data?

I'm calling Melo like this and no mean regression:

commutes = False
lines = np.arange(-59.5, 60.5)

ncaa_spreads = Melo(k, lines=lines, commutes=commutes)
ncaa_spreads.fit(dates, teams_w, teams_l, spreads, biases)

for index, row in test_results.iterrows():
    winning_probs[index] = ncaa_spreads.probability(row['SelectionSunday'], row['WTeamID'], row['LTeamID'])

But on a rolling year validation, I am getting 100% accuracy (log loss goes to zero) which means that the model must just learn that the first team always wins?

Is there a way I could re-format the data or change an option to prevent this?

morelandjs commented 3 years ago

Hi Anjum48,

You need to transform the data into a format which is compatible with generating predictions. Since it is impossible to know who the winning team is a priori, you must instead recast your training data into a format such as

date, team_home, team_away, home_spread

where home_spread = home_points - away_points. Apologies for the terribly late response! If you need more help, let me know. World got crazy in March...

Best, Scott