Skip to content

Commit 74dcb35

Browse files
authored
support xgboost 3+, add ubj models (#26)
* support xgboost 3+, add ubj models * fix globalvariables * bumpver * don't skip tests on warning
1 parent b1c6f35 commit 74dcb35

File tree

8 files changed

+13
-10
lines changed

8 files changed

+13
-10
lines changed

.Rbuildignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@
1414
^codecov\.yml$
1515
^\.Renviron$
1616
^vignettes$
17+
^local$

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
.httr-oauth
66
.DS_Store
77
docs
8+
local/

DESCRIPTION

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Package: ffopportunity
22
Title: Models for Fantasy Football Expected Points
3-
Version: 0.1.1
3+
Version: 0.1.2
44
Authors@R: c(
5-
person("Joe", "Sydlowski", , "syd235@gmail.com", role = c("aut", "cre", "cph")),
6-
person("Tan", "Ho", , "tan@tanho.ca", role = "aut", comment = c(ORCID = "0000-0001-8388-5155"))
5+
person("Joe", "Sydlowski", , "syd235@gmail.com", role = c("aut", "cph")),
6+
person("Tan", "Ho", , "tan@tanho.ca", role = c("aut", "cre"), comment = c(ORCID = "0000-0001-8388-5155"))
77
)
88
Description: Downloads expected fantasy points data from 'ffverse'
99
repositories if available, and otherwise builds up expected points

NEWS.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@
99
* Combine variants of ep_load into one function `ep_load()` with arguments
1010
* Rename to ffopportunity
1111
* Include spikes and kneel downs to tie out to official stats with `ep_summarize()`
12-
* Fix YAC bug in pbp_pass data
12+
* Fix YAC bug in pbp_pass data
13+
* Update to support ubj models which should enable xgboost 3.1+ support

R/ep_predict.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,14 @@ ep_predict <- function(preprocessed_pbp, version = c("latest", "v1.0.0")) {
114114
# automatically/prompt-for download if file not found?
115115
# future: add some kind of version selector (as package option?)
116116
#' @keywords internal
117-
.load_model_objs <- function(variable, version) {
117+
.load_model_objs <- function(variable, version, model_file_type = c(".ubj", ".xgb")) {
118+
model_file_type <- match.arg(model_file_type)
118119

119120
cache_dir <- rappdirs::user_cache_dir("ffopportunity", "ffverse")
120121

121122
folder_path <- file.path(cache_dir,version)
122123

123-
model_path <- file.path(folder_path, paste0(variable,".xgb"))
124+
model_path <- file.path(folder_path, paste0(variable, model_file_type))
124125
blueprint_path <- file.path(folder_path, paste0(variable,".rds"))
125126

126127
stopifnot(file.exists(model_path), file.exists(blueprint_path))

R/utils.R

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,5 +90,4 @@ rds_from_url <- function(url) {
9090
#' @keywords internal
9191
is_installed <- function(pkg) requireNamespace(pkg, quietly = TRUE)
9292

93-
utils::globalVariables("where")
94-
93+
utils::globalVariables(c("where", "contains"))

R/utils_gh_cli.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ gh_cli_release_assets <- function(tag, ..., repo = "ffverse/ffopportunity") {
108108

109109
out <- .cli_parse_json(cli_output = cli_output)[["assets"]]
110110

111+
name <- size <- downloadCount <- updatedAt <- size_string <- NULL
112+
111113
setDT(out)
112114
ret <- out[,
113115
list(name, size, downloads = downloadCount, last_update = updatedAt, url)

tests/testthat/setup.R

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,9 @@ if(gha_online){
1212
ep_cache_models(version = "v1.0.0")
1313
pbp_2020 <- nflreadr::load_pbp(2020)
1414
},
15-
warning = function(e) skip <<- TRUE,
1615
error = function(e) skip <<- TRUE
1716
)
1817
}
1918

2019
skippy <- function() NULL
2120
if (skip) skippy <- function() testthat::skip(message = "Unable to connect to GHA")
22-

0 commit comments

Comments
 (0)