tra-analysis/analysis-master/tra_analysis/metrics/elo.py

7 lines
221 B
Python
Raw Permalink Normal View History

2020-04-28 04:00:19 +00:00
import numpy as np
def calculate(starting_score, opposing_score, observed, N, K):
expected = 1/(1+10**((np.array(opposing_score) - starting_score)/N))
2020-04-28 04:00:19 +00:00
return starting_score + K*(np.sum(observed) - np.sum(expected))