def __init__(self, name=None, fname=None, numgames=None, qbName=None): self.team_name = name self.score = 0 self.runModel = None self.n_neighbors = 5 self.qbNames = map(str, rosters[name]['QB']) self.DEF_STATS = None self.PassData = data_ops.PassData( './data/2013_nfl_pbp_through_wk_12.csv') if fname is not None: #print "getting models with data: " + fname self.getRunModel(fname) self.learnFromPastGames(fname, numgames, self.qbNames) #self.knn = learn.learnKNN( self.allXdata, self.allYdata, n=5) self.knn = learn.learnKNN(self.teamRunningX, self.teamRunningY, n=5) ydata = [] xdata = [] for e in self.passplays: #get knn for completions only if e[-1] != 0: xdata.append(e[0:-1]) ydata.append(e[-1]) self.passKNN = learn.learnKNN(xdata, ydata, n=3)
def __init__(self,team_1=None, team_2=None, classifiers=None): random.seed() self.playcounts = {"Run":0,"Pass":0} self.team_1 = None self.team_2 = None self.game_classifiers = classifiers score = {} score[self.team_1] = 0 score[self.team_2] = 0 self.score = score self.game_stats = {} self.yards_to_first_down = 10 self.yards_to_toucdown = 80 self.yardline = 80 self.down = 1 self.O = None self.D = None self.series_first_down = 0 self.time_left_this_quarter = 900 self.time_left_this_game = 4*900 self. quarter = 1 self.winner = None self.switchOffense = False self.turn_over_on_downs = False self.scored = False self.summary = [] self.n_neighbors = 6 self.R = data_ops.RunData('2013_nfl_pbp_through_wk_12.csv') self.runX,self.runY = self.R.RunTrainData() self.knn = learn.learnKNN(self.runX, self.runY,self.n_neighbors)
def __init__(self, name=None, fname=None, numgames=None, qbName=None ): self.team_name = name self.score = 0 self.runModel = None self.n_neighbors = 5 self.qbNames = map(str,rosters[name]['QB']) self.DEF_STATS = None self.PassData = data_ops.PassData('./data/2013_nfl_pbp_through_wk_12.csv') if fname is not None: #print "getting models with data: " + fname self.getRunModel(fname) self.learnFromPastGames(fname,numgames,self.qbNames) #self.knn = learn.learnKNN( self.allXdata, self.allYdata, n=5) self.knn = learn.learnKNN( self.teamRunningX, self.teamRunningY, n=5) ydata = [] xdata = [] for e in self.passplays: #get knn for completions only if e[-1] != 0: xdata.append(e[0:-1]) ydata.append(e[-1]) self.passKNN = learn.learnKNN( xdata, ydata,n=3)