コード例 #1
0
ファイル: Team.py プロジェクト: ceyevar/CSCE436
    def getPlayoffProbability(playoffpoints, playoffgamesplayed, schedule, teampoints, teamgamesplayed, teamelo):
        #playoff points: 8th highest in the conference of the team
        #playoff gamesplayed: 8th highest num of gamesplayed
        #schedule: ***FUTURE*** list of elo values for remaining games in season ex. [1050, 1060, 1007, 1100]
                #current elo values for the future schedule
        #points : current points of team
        #teamgamesplayed: num of games played for team
        #elo: elo of team

        playoff_pointsneeded = (82-playoffgamesplayed)*(playoffpoints/playoffgamesplayed) + playoffpoints
        if(82-teamgamesplayed > 0 ):
            my_ppg = (playoff_pointsneeded-teampoints)/(82-teamgamesplayed)
        elif(82-teamgamesplayed == 0 and playoffpoints < teampoints):
            return 1.0
        else:
            return 0.0
        
        print(playoff_pointsneeded-teampoints)
        print(82-teamgamesplayed)

        schedule_perc = []
        for elem in schedule:
            schedule_perc.append(EloCalculator.winPercentageBetween(teamelo, elem))

        func = PoiBin(schedule_perc)

        print(my_ppg)
        print(int(len(schedule_perc)*(my_ppg/2)))
        if(my_ppg < 2):
            winperc = func.pmf(int(len(schedule_perc)*(my_ppg/2)))
        else:
            winperc = 0

        return winperc  
コード例 #2
0
ファイル: Team.py プロジェクト: ceyevar/CSCE436
def main():
    team1 = Team("Stars", 0, 0, 0, 1000)
    team2 = Team("Islanders", 0, 0, 0, 1000)

    teams = []
    teams.append(team1)
    teams.append(team2)
    listprob = [.47, .50, .30]
    func = PoiBin(listprob)
    print(func.pmf(2))
    gamelength = 10
コード例 #3
0
    def ifWin(self, team1, team2):
        current_points = team1.win * 2 + team1.otl
        new_points = current_points + 2

        team_competing = self.pointsToMakePlayoffs(team1.conference)

        neededpoints = (team_competing.win * 2 + team_competing.otl)

        ppg_top = neededpoints / team_competing.gamesplayed
        points_end = neededpoints + ppg_top * (82 - team_competing.gamesplayed)
        ppg_needed = (points_end - new_points) / (82 - team1.gamesplayed)
        ppg_prev = (points_end - current_points) / (82 - team1.gamesplayed)

        schedule = team1.schedule
        schedule_perc = self.getScheduleProbability(team1, schedule)

        print(schedule_perc)
        func = PoiBin(schedule_perc)
        print(func.pmf(int(len(schedule) * (ppg_needed / 2))))
        print(func.pmf(int(len(schedule) * (ppg_needed / 2) - 1)))
コード例 #4
0
    def getPlayoffProbability(self, team):
        team_competing = self.pointsToMakePlayoffs(team.conference)

        neededpoints = (team_competing.win * 2 + team_competing.otl)
        currentpoints = 2 * team.win + team.otl

        ppg_top = neededpoints / team_competing.gamesplayed
        points_end = neededpoints + ppg_top * (82 - team_competing.gamesplayed)
        ppg_needed = (points_end - currentpoints) / (82 - team.gamesplayed)

        schedule = team.schedule
        schedule_perc = self.getScheduleProbability(team, schedule)

        print(schedule_perc)
        func = PoiBin(schedule_perc)
        print(int(len(schedule_perc) * (ppg_needed / 2)))
        print(func.pmf(int(len(schedule) * (ppg_needed / 2))))

        print("need pts", ppg_needed)