Documentation ¶
Index ¶
- type Game
- type Model
- type ModelPerformance
- type NoisySpreadPick
- type Picker
- type Picks
- type Prediction
- type SagarinModelParameters
- type SagarinRating
- type Schedule
- type SeasonSchedule
- type Slate
- type SlateRowBuilder
- type StraightUpPick
- type StreakPick
- type StreakPrediction
- type StreakPredictions
- type StreakTeamsRemaining
- type StreakTeamsRemainingWeek
- type StreakWeek
- type SuperDogPick
- type Team
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Game ¶ added in v0.0.2
type Game struct { // HomeTeam is the team that the slate calls the home team for this game. A value of `nil` will cause runtime errors. HomeTeam *firestore.DocumentRef `firestore:"home"` // AwayTeam is the team that the slate calls the away team for this game. A value of `nil` will cause runtime errors. AwayTeam *firestore.DocumentRef `firestore:"road"` // HomeRank is the rank given to `HomeTeam` by the slate. A rank of zero means the team is unranked. HomeRank int `firestore:"rank1"` // AwayRank is the rank given to `AwayTeam` by the slate. A rank of zero means the team is unranked. AwayRank int `firestore:"rank2"` // GOTW is true if this is a "game of the week." GOTW bool `firestore:"gotw"` // Superdog is true if this game is a "superdog pick." Superdog bool `firestore:"superdog"` // Overdog is the team favored to win a superdog pick game. Is `nil` if `!Superdog`, otherwise must be a valid document reference. Overdog *firestore.DocumentRef `firestore:"overdog"` // Underdog is the team not favored to win a superdog pick game. Is `nil` if `!Superdog`, otherwise must be a valid document reference. Underdog *firestore.DocumentRef `firestore:"underdog"` // Value is the point value of this game. Value int `firestore:"value"` // NeutralSite is true if the slate thinks this game takes place at a neutral site. NeutralSite bool `firestore:"neutral_site"` // NoisySpread is the spread against which the pickers are picking this game. A value of zero means a straight pick. Positive values favor `HomeTeam`. NoisySpread int `firestore:"noisy_spread"` // Row is the row in the original slate where the game was found when parsed. It is the row that will contain the pick when picks are made. Row int `firestore:"row"` }
Game is a game's data for storing picks in Firestore.
type Model ¶
type Model struct { // System is a long descriptive name of the model. // It is human-readable, and is chiefly used to identify the model on ThePredictionTracker.com public-facing web pages. System string `firestore:"name,omitempty"` // ShortName is a short label given to the model. // It is not always human-readable, and is used to identify the model on ThePredictionTracker.com's downloadable CSV files. // All begin with the string "line". ShortName string `firestore:"short_name,omitempty"` }
Model contains the information necessary to identify an NCAA football prediction model as defined by ThePredictionTracker.com.
type ModelPerformance ¶
type ModelPerformance struct { // Rank is the weekly performance rank of the model as calculated by ThePredictionTracker.com using `PercentCorrect`. // The best performing model of the season to date is given `Rank = 1`. Rank int `firestore:"rank"` // System is a long descriptive name of the model. // It is human-readable, and is chiefly used to identify the model on ThePredictionTracker.com public-facing web pages. // It matches the same named field of the `Model` struct. System string `firestore:"system"` // PercentCorrect is the percent of games the model made a prediction for that were predicted correctly. // Because different models choose to predict only certain games every week, the denominator of this percentage // may not be consistent across models. PercentCorrect float64 `firestore:"pct_correct"` // PercentATS is the percent of games the model has predicted correctly against the opening line (Against The Spread). // This is only defined for models that predict the score of games rather than a boolean predicting who wins and who loses. // This is also not defined for the opening line model for obvious reasons. // For example of a correct pick against the opening line, imagine teams A and B are playing against each other and the opening // line is -5 (5 points in favor of team A). If the model predicts a spread of -7 (7 points in favor of team A) and the // final score of the game is 21-18 (team A wins by 3), then the model will be given a point for `PercentCorrect`, but not for // `PercentATS` because it predicted that team A would win by more than the opening line, but team A won by less than the opening line. PercentATS float64 `firestore:"pct_against_spread"` // MAE is the Mean Absolute Error in predicted score for games where the model has made a prediction. // The value is always non-negative. MAE float64 `firestore:"mae"` // MSE is the Mean Squared Error in predicted score for games where the model has made a prediction. // The value is always non-negative. MSE float64 `firestore:"mse"` // Bias is the mean error in predicted score for games where the model has made a prediction. // A positive value is a bias in favor of the home team (or the nominal home team if the game is played at a neutral site). Bias float64 `firestore:"bias"` // GamesPredicted are the number of games for which the model made a prediction. It is the denominator of the measures above. GamesPredicted int `firestore:"games"` // Wins is the number of correctly predicted game outcomes. Wins int `firestore:"suw"` // Losses is the number of incorrectly predicted game outcomes. Equal to `GamesPredicted - Wins`. Losses int `firestore:"wul"` // WinsATS are the wins "Against The Spread". It is the number of games in which the model correctly predicts whether the // difference in scores is on one side or the other of the opening line. // For example of a correct pick against the opening line, imagine teams A and B are playing against each other and the opening // line is -5 (5 points in favor of team A). If the model predicts a spread of -7 (7 points in favor of team A) and the // final score of the game is 21-18 (team A wins by 3), then the model will be given a point for `Wins`, but not for // `WinsATS` because it predicted that team A would win by more than the opening line, but team A won by less than the opening line. WinsATS int `firestore:"atsw"` // LossesATS are the losses "Against The Spread". It is the number of games in which the model incorrectly predicts whether the // difference in scores is on one side or the other of the opening line. Equal to `GamesPredicted - WinsATS`. LossesATS int `firestore:"atsl"` // StdDev is the standard deviation of the prediction errors. StdDev float64 `firestore:"std_dev"` // calculated // Model is a pointer to the Firestore model object it references for easy access. Model *fs.DocumentRef `firestore:"model"` // discovered }
ModelPerformance contains information about how the model has performed to date during a given NCAA football season.
type NoisySpreadPick ¶ added in v0.0.3
type NoisySpreadPick struct { // HomeTeam is the true home team (not what is listed in the slate). HomeTeam *firestore.DocumentRef `firestore:"home"` // AwayTeam is the true road team (not what is listed in the slate). AwayTeam *firestore.DocumentRef `firestore:"road"` // HomeRank is the rank of the home team (zero implies unranked). HomeRank int `firestore:"rank1"` // AwayRank is the rank of the away team (zero implies unranked). AwayRank int `firestore:"rank2"` // NoisySpread is the spread against which the game is picked. NoisySpread int `firestore:"noisy_spread"` // NeutralSite is the true neutral site nature of the game (not is listed in the slate). NeutralSite bool `firestore:"neutral_site"` // NeutralDisagreement is whether or not the slate lied to us about the neutral site of the game. NeutralDisagreement bool `firestore:"neutral_disagreement"` // Swap is whether or not the slate lied to us about who are the home and road teams. HomeAwaySwap bool `firestore:"swap"` // Pick is what the user picked, regardless of the model output. Pick *firestore.DocumentRef `firestore:"pick"` // PredictedSpread is the spread as predicted by the selected model. PredictedSpread float64 `firestore:"predicted_spread"` // PredictedProbability is the probability the pick is correct (including possible noisy spread adjustments). PredictedProbability float64 `firestore:"predicted_probability"` // ModeledGame is a reference to the spread from the model used to make the pick ModeledGame *firestore.DocumentRef `firestore:"modeled_game"` // Row is the row in the slate whence the pick originated. Row int `firestore:"row"` }
NoisySpreadPick is a pick on a noisy spread game.
func (NoisySpreadPick) BuildSlateRow ¶ added in v0.0.3
func (sg NoisySpreadPick) BuildSlateRow(ctx context.Context) ([]string, error)
BuildSlateRow creates a row of strings for direct output to a slate spreadsheet.
type Picker ¶ added in v0.0.5
type Picker struct { // Name is the picker's full name. Name string `firestore:"name"` // LukeName is the picker's name as used in the slates and recap emails. LukeName string `firestore:"name_luke"` // Joined is a timestamp marking when the picker joined Pick 'Em. Joined time.Time `firestore:"joined"` }
Picker represents a picker in the datastore.
type Picks ¶ added in v0.0.3
type Picks struct { // Season is a reference to the season document for these picks. Season *firestore.DocumentRef `firestore:"season"` // Week is the week number of the picks. Week int `firestore:"week"` // Timestamp is the time the picks were written to Firestore. Timestamp time.Time `firestore:"timestamp,serverTimestamp"` // Picker is a reference to the picker. Picker *firestore.DocumentRef `firestore:"picker"` }
Picks represents a collection of pickers' picks for the week.
type Prediction ¶
type Prediction struct { // HomeTeam is a reference to the Firestore Team the model thinks is the home team for the game. HomeTeam *fs.DocumentRef `firestore:"home"` // AwayTeam is a reference to the Firestore Team the model thinks is the away team for the game. AwayTeam *fs.DocumentRef `firestore:"road"` // NeutralSite flags if the model thinks the teams are playing at a neutral site. NeutralSite bool `firestore:"neutral"` // Spread is the predicted number of points in favor of `HomeTeam`. // Negative points reflect a prediction of `AwayTeam` winning. Spread float64 `firestore:"spread"` }
Prediction is a prediction made by a certain Model.
type SagarinModelParameters ¶
type SagarinModelParameters struct { // Timestamp is the time the scraped model parameters were saved to Firestore. Timestamp time.Time `firestore:"timestamp,serverTimestamp"` // TimeDownload is the time the model parameters were downloaded TimeDownloaded time.Time `firestore:"time_downloaded,omitempty"` // URL is the URL that was scraped URL string `firestore:"url_scraped,omitempty"` // RatingHomeAdvantage is the number of points the home team for a given contest should be given if using the default "ratings" method for prediction. RatingHomeAdvantage float64 `firestore:"home_advantage_rating"` // PointsHomeAdvantage is the number of points the home team for a given contest should be given if using the "points-only" method for prediction. PointsHomeAdvantage float64 `firestore:"home_advantage_points"` // GoldenMeanHomeAdvantage is the number of points the home team for a given contest should be given if using the "golden mean" method for prediction. GoldenMeanHomeAdvantage float64 `firestore:"home_advantage_golden_mean"` // RecentHomeAdvantage is the number of points the home team for a given contest should be given if using the "recent" method for prediction. RecentHomeAdvantage float64 `firestore:"home_advantage_recent"` }
SagarinModelParameters represents Sagarin home field advantages for one scraping of Sagarin rankings.
type SagarinRating ¶
type SagarinRating struct { // Team is a reference to the Firestore document of the team to which these ratings apply. Team *firestore.DocumentRef `firestore:"team"` // Rating is the number of points this team is predicted to score against an average NCAA Division I-A team at a neutral site using the default "ratings" method for prediction. Rating float64 `firestore:"rating"` // Points is the number of points this team is predicted to score against an average NCAA Division I-A team at a neutral site using the "points-only" method for prediction. Points float64 `firestore:"points"` // GoldenMean is the number of points this team is predicted to score against an average NCAA Division I-A team at a neutral site using the "golden mean" method for prediction. GoldenMean float64 `firestore:"golden_mean"` // Recent is the number of points this team is predicted to score against an average NCAA Division I-A team at a neutral site using the "recent" method for prediction. Recent float64 `firestore:"recent"` }
SagarinRating represents a team's Sagarin ratings in Firestore.
type Schedule ¶ added in v0.0.8
type Schedule struct { // Team is a reference to the team this schedule represents. Team *firestore.DocumentRef `firestore:"team"` // RelativeLocations are the locations relative to `Team`. Values are: // * 2: this game takes place in the home stadium of `Team`. // * 1: this game takes place at a neutral site close to `Team`'s home. // * 0: this game takes place at a truly neutral site. // * -1: this game takes place at a neutral site close to the opponent's home. // * -2: this game takes place in the opponent's stadium. // These are in schedule order. RelativeLocations []int `firestore:"locales"` // Opponents are references to teams that `Team` is playing. They are in schedule order. Opponents []*firestore.DocumentRef `firestore:"opponents"` }
Schedule is a team's schedule in Firestore format
type SeasonSchedule ¶ added in v0.0.8
type SeasonSchedule struct { // Season is a reference to the season. Season *firestore.DocumentRef `firestore:"season"` // Timestamp is the time this document is written to the server. Timestamp time.Time `firestore:"timestamp,serverTimestamp"` }
SeasonSchedule represents a document in firestore that contains team schedules
type Slate ¶ added in v0.0.2
type Slate struct { // Bucket is the name of the GC Storage bucket containing the original slate. Bucket string `firestore:"bucket_name"` // Created is the creation timestamp of the slate. Created time.Time `firestore:"created"` // FileName is the name of the slate file in `Bucket`. FileName string `firestore:"file"` // Season is a reference to the season document this slate refers to. Season *firestore.DocumentRef `firestore:"season"` // Week is the week in the season this slate refers to. Week int `firestore:"week"` }
Slate represents how a slate is stored in Firestore.
type SlateRowBuilder ¶ added in v0.0.3
type StraightUpPick ¶ added in v0.0.3
type StraightUpPick struct { // HomeTeam is the true home team (not what is listed in the slate). HomeTeam *firestore.DocumentRef `firestore:"home"` // AwayTeam is the true road team (not what is listed in the slate). AwayTeam *firestore.DocumentRef `firestore:"road"` // HomeRank is the rank of the home team (zero implies unranked). HomeRank int `firestore:"rank1"` // AwayRank is the rank of the away team (zero implies unranked). AwayRank int `firestore:"rank2"` // GOTW stands for "Game of the Week." GOTW bool `firestore:"gotw"` // NeutralSite is the true neutral site nature of the game (not is listed in the slate). NeutralSite bool `firestore:"neutral_site"` // NeutralDisagreement is whether or not the slate lied to us about the neutral site of the game. NeutralDisagreement bool `firestore:"neutral_disagreement"` // Swap is whether or not the slate lied to us about who are the home and road teams. HomeAwaySwap bool `firestore:"swap"` // Pick is what the user picked, regardless of the model output. Pick *firestore.DocumentRef `firestore:"pick"` // PredictedSpread is the spread as predicted by the selected model. PredictedSpread float64 `firestore:"predicted_spread"` // PredictedProbability is the probability the pick is correct (including possible noisy spread adjustments). PredictedProbability float64 `firestore:"predicted_probability"` // ModeledGame is a reference to the spread from the model used to make the pick ModeledGame *firestore.DocumentRef `firestore:"modeled_game"` // Row is the row in the slate whence the pick originated. Row int `firestore:"row"` }
StraightUpPick is a pick on a game with no spread.
func (StraightUpPick) BuildSlateRow ¶ added in v0.0.3
func (sg StraightUpPick) BuildSlateRow(ctx context.Context) ([]string, error)
BuildSlateRow creates a row of strings for direct output to a slate spreadsheet.
type StreakPick ¶ added in v0.0.3
type StreakPick struct { // Picks is what the user picked, regardless of the model output. // Note that there could be multiple picks per week. Picks []*firestore.DocumentRef `firestore:"picks"` // PredictedSpread is the spread of the remaining games in the optimal streak as predicted by the selected model. PredictedSpread float64 `firestore:"predicted_spread"` // PredictedProbability is the probability of beating the streak. PredictedProbability float64 `firestore:"predicted_probability"` }
StreakPick is a pick for Beat the Streak (BTS).
func (StreakPick) BuildSlateRow ¶ added in v0.0.3
func (sg StreakPick) BuildSlateRow(ctx context.Context) ([]string, error)
BuildSlateRow creates a row of strings for direct output to a slate spreadsheet. TODO: still not printing DDs correctly.
type StreakPrediction ¶ added in v0.0.6
type StreakPrediction struct { // CumulativeProbability is the total cumulative probability of streak win for all the picks in `Weeks`. CumulativeProbability float64 `firestore:"cumulative_probability"` // CumulativeSpread is the total cumulative spreads for all the picks in `Weeks`. CumulativeSpread float64 `firestore:"cumulative_spread"` // Weeks are the picked streak winners for all future weeks. Weeks []StreakWeek `firestore:"weeks"` }
StreakPrediction is a prediction for a complete streak.
type StreakPredictions ¶ added in v0.0.6
type StreakPredictions struct { // Picker is a reference to who is making the pick. Picker *firestore.DocumentRef `firestore:"picker"` // Season is a reference to the season of the pick. Season *firestore.DocumentRef `firestore:"season"` // Week is the week number of the pick (0 is just before the first week of the season). Week int `firestore:"week"` // TeamsRemaining are the teams the picker has remaining to pick in the streak. TeamsRemaining []*firestore.DocumentRef `firestore:"remaining"` // PickTypesRemaining is an array slice of number of pick types remaining for the user. // The index of the array represents the number of picks per week for that type. // For instance, the first (index 0) element in the array represents the number of "bye" picks the user has remaining, // while the second (index 1) element represents the number of "single" picks remaining, // and the third (index 2) represents the number of "double down" weeks remaining. PickTypesRemaining []int `firestore:"pick_types_remaining"` // Schedule is a reference to the schedule of games used to make these predictions. Schedule *firestore.DocumentRef `firestore:"schedule"` // Sagarin is a reference to the Sagarin prediction model used to make these predictions. Sagarin *firestore.DocumentRef `firestore:"sagarin"` // PredictionTracker is a reference to the TPT data used to evaluate the performance of the Sagarin model used to make these predictions. PredictionTracker *firestore.DocumentRef `firestore:"prediction_tracker"` // CalculationStartTime is when the program that produced the results started. CalculationStartTime time.Time `firestore:"calculation_start_time"` // CalculationEndTime is when the results were generated and finalized. CalculationEndTime time.Time `firestore:"calculation_end_time"` // BestPick is a reference to the team to pick this week that the model thinks gives the picker the best chance of beating the streak. // Multiple picks are possible per week. BestPick []*firestore.DocumentRef `firestore:"best_pick"` // Probability is the total probability of beating the streak given optimal selection. Probability float64 `firestore:"probability"` // Spread is the sum total spread in the picked games given optimal selection. Spread float64 `firestore:"spread"` // PossiblePicks are the optimal streaks calculated for each possible remaining pick. PossiblePicks []StreakPrediction `firestore:"possible_picks"` }
StreakPredictions records the best predicted streak and the possible streaks for a given picker.
type StreakTeamsRemaining ¶ added in v0.0.9
type StreakTeamsRemaining struct { // Picker is a reference to the picker. Picker *firestore.DocumentRef `firestore:"picker"` // TeamsRemaining is a list of references to remaining teams for that picker. TeamsRemaining []*firestore.DocumentRef `firestore:"remaining"` // PickTypesRemaining is an array slice of number of pick types remaining for the user. // The index of the array represents the number of picks per week for that type. // For instance, the first (index 0) element in the array represents the number of "bye" picks the user has remaining, // while the second (index 1) element represents the number of "single" picks remaining, // and the third (index 2) represents the number of "double down" weeks remaining. PickTypesRemaining []int `firestore:"pick_types_remaining"` }
StreakTeamsRemaining represents the remaining teams and pick types per picker
type StreakTeamsRemainingWeek ¶ added in v0.0.9
type StreakTeamsRemainingWeek struct { // Season is a reference to the season of the pick. Season *firestore.DocumentRef `firestore:"season"` // Week is the week number of the pick (0 is just before the first week of the season). Week int `firestore:"week"` // Timestamp is the time the document was written to Firestore. Timestamp time.Time `firestore:"timestamp,serverTimestamp"` }
StreakTeamsRemainingWeek is a container for the remaining teams by picker.
type StreakWeek ¶ added in v0.0.6
type StreakWeek struct { // Week is the week number of the pick (0 is just before the first week of the season). Week int `firestore:"week"` // Pick is a reference to the team to pick this week that the model thinks gives the picker the best chance of beating the streak. // Multiple picks are possible per week. Pick []*firestore.DocumentRef `firestore:"pick"` // Probabilities are the probabilities of each team in `Pick` winning this week. Probabilities []float64 `firestore:"probabilities"` // Spreads are the predicted spreads of each game in `Pick` (positive favoring the picked team). Spreads []float64 `firestore:"spreads"` }
StreakWeek is a week's worth of streak picks.
type SuperDogPick ¶ added in v0.0.3
type SuperDogPick struct { // Underdog is what the slate called the underdog, regardless of model predictions. Underdog *firestore.DocumentRef `firestore:"underdog"` // Overdog is what the slate called the overdog, regardless of model predictions. Overdog *firestore.DocumentRef `firestore:"overdog"` // UnderdogRank is the rank of the underdog team (zero implies unranked). UnderdogRank int `firestore:"rank1"` // Overdog is the rank of the overdog team (zero implies unranked). OverdogRank int `firestore:"rank2"` // Value is the point value of the game. Value int `firestore:"value"` // NeutralSite is the true neutral site nature of the game (not is listed in the slate). NeutralSite bool `firestore:"neutral_site"` // NeutralDisagreement is whether or not the slate lied to us about the neutral site of the game. NeutralDisagreement bool `firestore:"neutral_disagreement"` // Swap is whether or not the slate lied to us about who are the home and road teams. HomeAwaySwap bool `firestore:"swap"` // Pick is what the user picked, regardless of the model output. // A nil value means this game was not picked by the user. Pick *firestore.DocumentRef `firestore:"pick"` // PredictedSpread is the spread as predicted by the selected model. PredictedSpread float64 `firestore:"predicted_spread"` // PredictedProbability is the probability the pick is correct (including possible noisy spread adjustments). PredictedProbability float64 `firestore:"predicted_probability"` // ModeledGame is a reference to the spread from the model used to make the pick ModeledGame *firestore.DocumentRef `firestore:"modeled_game"` // Row is the row in the slate whence the pick originated. Row int `firestore:"row"` }
SuperDogPick is a pick on a superdog spread game.
func (SuperDogPick) BuildSlateRow ¶ added in v0.0.3
func (sg SuperDogPick) BuildSlateRow(ctx context.Context) ([]string, error)
BuildSlateRow creates a row of strings for direct output to a slate spreadsheet.
type Team ¶
type Team struct { // Name4 is a short, capitalized abbreviation of the team's name. // By convention, it is at most 4 characters long. There is no authoritative list of Name4 names, // but traditionally they have been chosen to match the abbreviated names that are used by ESPN. // Examples include: // - MICH (University of Michigan Wolverines) // - OSU (The Ohio State University Buckeyes) // - M-OH (Miami University of Ohio RedHawks) Name4 string `firestore:"name_4"` // LukeName are capitalized abbreviations that Luke Henkel has given to the team. // There is no authoritative list of these names, and they are not necessarily consistent over time (hence the array slice). // Examples include: // - MICH (University of Michigan Wolverines) // - OSU (The Ohio State University Buckeyes) // - CINCY (University of Cincinnati Bearcats) LukeNames []string `firestore:"name_luke,omitempty"` // OtherNames are the names that various other documents give to the team. // These are collected over time as various sports outlets call the team different official or unofficial names. // Examples include: // - [Michigan] (University of Michigan Wolverines) // - [Ohio St., Ohio State] (The Ohio State University Buckeyes) // - [Pitt, Pittsburgh] (University of Pittsburgh Panthers) OtherNames []string `firestore:"other_names,omitempty"` // School is the unofficial, unabbreviated name of the school used for display purposes. // Examples include: // - Michigan (University of Michigan Wolverines) // - Ohio State (The Ohio State University Buckeyes) // - Southern California (University of Southern California Trojans) School string `firestore:"school"` // Name is the official nickname of the team. // Examples include: // - Wolverines (University of Michigan Wolverines) // - Buckeyes (The Ohio State University Buckeyes) // - Chanticleers (Coastal Carolina Chanticleers) Name string `firestore:"team"` }
Team represents an NCAA football team.