This commit is contained in:
art 2019-10-05 16:53:03 -05:00
parent 92f376e598
commit 6663eb3d00

View File

@ -168,6 +168,7 @@ __all__ = [
'regression', 'regression',
'elo', 'elo',
'gliko2', 'gliko2',
'trueskill',
'r_squared', 'r_squared',
'mse', 'mse',
'rms', 'rms',
@ -186,13 +187,13 @@ from numba import jit
import numpy as np import numpy as np
import math import math
try: try:
from analysis import regression from analysis import regression as Regression
except: except:
pass pass
try: try:
from analysis import trueskill as ts from analysis import trueskill as Trueskill
except: except:
import trueskill as ts import trueskill as Trueskill
from sklearn import metrics from sklearn import metrics
from sklearn import preprocessing from sklearn import preprocessing
import torch import torch
@ -341,14 +342,14 @@ def trueskill(teams_data, observations):#teams_data is array of array of tuples
team_temp = [] team_temp = []
for player in team: for player in team:
if player != None: if player != None:
player = ts.Rating(player[0], player[1]) player = Trueskill.Rating(player[0], player[1])
team_temp.append(player) team_temp.append(player)
else: else:
player = ts.Rating() player = Trueskill.Rating()
team_temp.append(player) team_temp.append(player)
team_ratings.append(team_temp) team_ratings.append(team_temp)
return ts.rate(teams_data, observations) return Trueskill.rate(teams_data, observations)
@jit(forceobj=True) @jit(forceobj=True)
def r_squared(predictions, targets): # assumes equal size inputs def r_squared(predictions, targets): # assumes equal size inputs