The goal of sdvmodels is to host the fitted models used by cfbfastR and the wider SportsDataverse ecosystem, in the way fastrmodels hosts the models of nflfastR. The models are the cfb_model_artifacts release of sportsdataverse-data, the single bundle that both cfbfastR and sportsdataverse-py score with, re-packaged byte for byte.
Data freshness and pipeline status for every SportsDataverse dataset: sportsdataverse.org/status.
Installation
You can install the development version of sdvmodels from GitHub with:
if (!requireNamespace("pak", quietly = TRUE)) install.packages("pak")
pak::pak("sportsdataverse/sdvmodels")
# or, with remotes:
# if (!requireNamespace("remotes", quietly = TRUE)) install.packages("remotes")
# remotes::install_github("sportsdataverse/sdvmodels")What is in it
| Object | Model | Objective |
|---|---|---|
cfb_ep_model |
Expected points (next score) |
multi:softprob, 7 classes |
cfb_wp_spread_model |
Win probability with the point spread | binary:logistic |
cfb_wp_naive_model |
Win probability without the spread | binary:logistic |
cfb_wp_ot_reach_model |
Probability the game reaches overtime | binary:logistic |
cfb_fg_model |
Field goal make probability | binary:logistic |
cfb_fd_model |
Fourth down yards-gained distribution |
multi:softprob, 76 classes |
cfb_two_pt_model |
Two point conversion | binary:logistic |
cfb_xpass_model |
Expected pass | binary:logistic |
cfb_cp_model |
Completion probability | binary:logistic |
cfb_cp_air_yards_model |
Completion probability where air yards are known | binary:logistic |
cfb_qbr_model |
Quarterback rating | reg:squarederror |
cfb_punt_distribution |
Net punt yardage by field position | data frame |
cfb_field_position_ep |
Expected points by yards to goal | data frame |
cfb_model_cards |
One model card per model | list |
cfb_model_manifest |
The bundle manifest (feature contracts, SHA-256, EP class order) | list |
Quick start
Each xgboost model is the raw UBJ byte vector of the released file, so it loads with any xgboost version that reads UBJ:
library(sdvmodels)
ep <- xgboost::xgb.load.raw(cfb_ep_model)
xgboost::getinfo(ep, "feature_name")
#> [1] "TimeSecsRem" "yards_to_goal" "distance"
#> [4] "down_1" "down_2" "down_3"
#> [7] "down_4" "pos_score_diff_start"
cfb_model_manifest$ep_class_contract$class_order
#> [1] "TD" "Opp_TD" "FG" "Opp_FG" "Safety"
#> [6] "Opp_Safety" "No_Score"Scoring a play, and the rest of the feature contracts, are walked through in Getting started.
Updating the models
The models are trained and published by the sportsdataverse-py model pipeline. To re-package a new bundle, download the release into data-raw/artifacts and run data-raw/MODELS.R:
Companion packages
- cfbfastR: college football play-by-play, scored with these models
- cfb4th: college football fourth-down decisions
- sportsdataverse-py: the Python side, which trains and scores the same bundle
- fastrmodels: the nflverse package sdvmodels mirrors
- sportsdataverse-R: the SportsDataverse R meta-package
The SportsDataverse
sdvmodels is part of the SportsDataverse, a set of open-source packages for sports data.
| Package | Sport / Scope |
|---|---|
| cfbfastR | College football |
| hoopR | Men’s basketball (NBA and NCAA) |
| wehoop | Women’s basketball (WNBA and NCAA) |
| fastRhockey | Hockey (NHL and PWHL) |
| baseballr | Baseball (MLB, MiLB, NCAA) |
| softballR | College softball |
| oddsapiR | Sports betting odds |
| recruitR | College football recruiting |
| usfootballR | US soccer |
| cfbseedR · cfb4th | CFB playoff simulation · fourth-down decisions |
| cfbplotR · sdvplotR · sportyR | Logos, colors, tables · playing surfaces |
| sportsdataverse-R | Umbrella R metapackage |
| sportsdataverse-py · sportsdataverse.js | Python and Node.js |
See the full ecosystem at sportsdataverse.org.
Code of Conduct
Please note that the sdvmodels project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.
License
MIT © Saiem Gilani. See LICENSE.md.
