-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcorrelations_teamRecord.py
112 lines (85 loc) · 5.17 KB
/
correlations_teamRecord.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
from scipy import stats
import pandas as pd
import numpy as np
import ncaam_helperfunctions as helper
import matplotlib.pyplot as plt
# #dict mapping a String identifier (year) to the tournamentWins dict for that year
# #tournamentWins dict is team name -> tournament wins
tournamentWinsAllYears,tournament_dates = helper.createTournamentWinsAllYears()
# # #dict mapping a String identifier (year) to the teamRoadWins dict for that year
# #teamRoadWins dict is team name -> team road win pct
# roadWinPctAllYears = helper.createRoadWinPctAllYears(tournament_dates)
# #todo: convert into a X NP Array -> roadWinPct and a Y NP Array -> tournamentTeamWins
# roadWinPct,tournamentWins = helper.createXYArraysRecord(roadWinPctAllYears,tournamentWinsAllYears)
# roadWinPct = np.asarray(roadWinPct,dtype=float)
# tournamentWins = np.asarray(tournamentWins,dtype=int)
# #todo: plot tournamentTeamWins vs roadWinPct
# plt.plot(roadWinPct,tournamentWins,"ro")
# plt.xlabel("roadWinPct")
# plt.ylabel("tournamentWins")
# #todo: apply Kendall Tau Correlation for x=road win% and y=# of NCAA Tournament Wins
# kendallTau,p = stats.kendalltau(roadWinPct,tournamentWins)
# print("The Kendall Tau Correlation between road win pct and ncaa tournament wins is: "+str(kendallTau))
# plt.show()
# tournament_dates = helper.createTournamentDateList(seenGames_1011,seenGames_1112,seenGames_1213,seenGames_1314,seenGames_1415,seenGames_1516,seenGames_1617,seenGames_1718)
#dict mapping a String identifier (year) to the teamRoadWins dict for that year
# print("THIS IS TOURNAMENT DATES23493753940573957390574309547390")
# print(tournament_dates)
teamWinPctAllYears = helper.createTeamWinPctAllYears(tournament_dates)
#todo: convert into a X NP Array -> roadWinPct and a Y NP Array -> tournamentTeamWins
teamWinPct,tournamentWins = helper.createXYArraysRecord(teamWinPctAllYears,tournamentWinsAllYears)
teamWinPct = np.asarray(teamWinPct,dtype=float)
tournamentWins = np.asarray(tournamentWins,dtype=int)
#todo: plot tournamentTeamWins vs roadWinPct
plt.plot(teamWinPct,tournamentWins,"ro")
plt.xlabel("teamWinPct")
plt.ylabel("tournamentWins")
#todo: apply Kendall Tau Correlation for x=road win% and y=# of NCAA Tournament Wins
kendallTau,p = stats.kendalltau(teamWinPct,tournamentWins)
print("The Kendall Tau Correlation between team overall win pct and ncaa tournament wins is: "+str(kendallTau))
plt.show()
#dict mapping a String identifier (year) to the teamRoadWins dict for that year
# homeWinPctAllYears = {}
# #dict mapping teamName str to road winning %
# homeWinPctAllYears["1011"] = helper.homeWinPct(allGames_1011)
# homeWinPctAllYears["1112"] = helper.homeWinPct(allGames_1112)
# homeWinPctAllYears["1213"] = helper.homeWinPct(allGames_1213)
# homeWinPctAllYears["1314"] = helper.homeWinPct(allGames_1314)
# homeWinPctAllYears["1415"] = helper.homeWinPct(allGames_1415)
# homeWinPctAllYears["1516"] = helper.homeWinPct(allGames_1516)
# homeWinPctAllYears["1617"] = helper.homeWinPct(allGames_1617)
# homeWinPctAllYears["1718"] = helper.homeWinPct(allGames_1718)
# #todo: convert into a X NP Array -> roadWinPct and a Y NP Array -> tournamentTeamWins
# homeWinPct,tournamentWins = helper.createXYArrays(homeWinPctAllYears,tournamentWinsAllYears)
# homeWinPct = np.asarray(homeWinPct,dtype=float)
# tournamentWins = np.asarray(tournamentWins,dtype=int)
# #todo: plot tournamentTeamWins vs roadWinPct
# plt.plot(homeWinPct,tournamentWins,"ro")
# plt.xlabel("homeWinPct")
# plt.ylabel("tournamentWins")
# #todo: apply Kendall Tau Correlation for x=road win% and y=# of NCAA Tournament Wins
# kendallTau,p = stats.kendalltau(homeWinPct,tournamentWins)
# print("The Kendall Tau Correlation between team home win pct and ncaa tournament wins is: "+str(kendallTau))
# plt.show()
# neutralWinPctAllYears = {}
# #dict mapping teamName str to road winning %
# neutralWinPctAllYears["1011"] = helper.neutralWinPct(allGames_1011,tournament_dates)
# neutralWinPctAllYears["1112"] = helper.neutralWinPct(allGames_1112,tournament_dates)
# neutralWinPctAllYears["1213"] = helper.neutralWinPct(allGames_1213,tournament_dates)
# neutralWinPctAllYears["1314"] = helper.neutralWinPct(allGames_1314,tournament_dates)
# neutralWinPctAllYears["1415"] = helper.neutralWinPct(allGames_1415,tournament_dates)
# neutralWinPctAllYears["1516"] = helper.neutralWinPct(allGames_1516,tournament_dates)
# neutralWinPctAllYears["1617"] = helper.neutralWinPct(allGames_1617,tournament_dates)
# neutralWinPctAllYears["1718"] = helper.neutralWinPct(allGames_1718,tournament_dates)
# #todo: convert into a X NP Array -> roadWinPct and a Y NP Array -> tournamentTeamWins
# neutralWinPct,tournamentWins = helper.createXYArrays(neutralWinPctAllYears,tournamentWinsAllYears)
# neutralWinPct = np.asarray(neutralWinPct,dtype=float)
# tournamentWins = np.asarray(tournamentWins,dtype=int)
# #todo: plot tournamentTeamWins vs roadWinPct
# plt.plot(neutralWinPct,tournamentWins,"ro")
# plt.xlabel("neutralWinPct")
# plt.ylabel("tournamentWins")
# #todo: apply Kendall Tau Correlation for x=road win% and y=# of NCAA Tournament Wins
# kendallTau,p = stats.kendalltau(neutralWinPct,tournamentWins)
# print("The Kendall Tau Correlation between team neutral win pct and ncaa tournament wins is: "+str(kendallTau))
# plt.show()