Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@
^inst/party-skill\.md$

^cran-comments\.md$
^_pkgdown\.yml$
36 changes: 35 additions & 1 deletion .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,43 @@ jobs:

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
extra-packages: |
any::rcmdcheck
catboost=?ignore
needs: check

# catboost is not on CRAN; pak is told to ignore it above and the
# binary release is installed from GitHub here.
- name: Install catboost
run: |
version <- "1.2.10"
sysname <- tolower(Sys.info()[["sysname"]])
if (sysname == "darwin") {
platform <- "darwin-universal2"
} else if (sysname == "windows") {
platform <- "windows-x86_64"
} else if (R.version$arch == "aarch64") {
platform <- "linux-aarch64"
} else {
platform <- "linux-x86_64"
}
url <- sprintf(
"https://github.com/catboost/catboost/releases/download/v%s/catboost-R-%s-%s.tgz",
version,
platform,
version
)
path <- file.path(tempdir(), basename(url))
download.file(url, path, mode = "wb")
install.packages(
path,
repos = NULL,
type = "source",
INSTALL_opts = c("--no-multiarch", "--no-test-load", "--no-staged-install")
)
library(catboost)
shell: Rscript {0}

- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
Expand Down
37 changes: 36 additions & 1 deletion .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,44 @@ jobs:

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::pkgdown, local::.
extra-packages: |
any::pkgdown
local::.
catboost=?ignore
needs: website

# catboost is not on CRAN; pak is told to ignore it above and the
# binary release is installed from GitHub here.
- name: Install catboost
run: |
version <- "1.2.10"
sysname <- tolower(Sys.info()[["sysname"]])
if (sysname == "darwin") {
platform <- "darwin-universal2"
} else if (sysname == "windows") {
platform <- "windows-x86_64"
} else if (R.version$arch == "aarch64") {
platform <- "linux-aarch64"
} else {
platform <- "linux-x86_64"
}
url <- sprintf(
"https://github.com/catboost/catboost/releases/download/v%s/catboost-R-%s-%s.tgz",
version,
platform,
version
)
path <- file.path(tempdir(), basename(url))
download.file(url, path, mode = "wb")
install.packages(
path,
repos = NULL,
type = "source",
INSTALL_opts = c("--no-multiarch", "--no-test-load", "--no-staged-install")
)
library(catboost)
shell: Rscript {0}

- name: Build site
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
shell: Rscript {0}
Expand Down
37 changes: 36 additions & 1 deletion .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,44 @@ jobs:

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::covr, any::xml2
extra-packages: |
any::covr
any::xml2
catboost=?ignore
needs: coverage

# catboost is not on CRAN; pak is told to ignore it above and the
# binary release is installed from GitHub here.
- name: Install catboost
run: |
version <- "1.2.10"
sysname <- tolower(Sys.info()[["sysname"]])
if (sysname == "darwin") {
platform <- "darwin-universal2"
} else if (sysname == "windows") {
platform <- "windows-x86_64"
} else if (R.version$arch == "aarch64") {
platform <- "linux-aarch64"
} else {
platform <- "linux-x86_64"
}
url <- sprintf(
"https://github.com/catboost/catboost/releases/download/v%s/catboost-R-%s-%s.tgz",
version,
platform,
version
)
path <- file.path(tempdir(), basename(url))
download.file(url, path, mode = "wb")
install.packages(
path,
repos = NULL,
type = "source",
INSTALL_opts = c("--no-multiarch", "--no-test-load", "--no-staged-install")
)
library(catboost)
shell: Rscript {0}

- name: Test coverage
run: |
cov <- covr::package_coverage(
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,4 @@ rsconnect/
# others
Rplots.pdf
train_dir
catboost_info/
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Imports:
Suggests:
aorsf,
C50,
catboost,
Cubist,
dbarts,
grf,
Expand Down
4 changes: 4 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
S3method(active_predictors,C5.0)
S3method(active_predictors,ObliqueForest)
S3method(active_predictors,bart)
S3method(active_predictors,catboost.Model)
S3method(active_predictors,cforest)
S3method(active_predictors,cubist)
S3method(active_predictors,grf)
Expand All @@ -14,6 +15,7 @@ S3method(active_predictors,rpart)
S3method(active_predictors,xgb.Booster)
S3method(as.party,C5.0)
S3method(as.party,bart)
S3method(as.party,catboost.Model)
S3method(as.party,grf)
S3method(as.party,lgb.Booster)
S3method(as.party,randomForest)
Expand All @@ -22,6 +24,7 @@ S3method(as.party,xgb.Booster)
S3method(extract_rules,C5.0)
S3method(extract_rules,ObliqueForest)
S3method(extract_rules,bart)
S3method(extract_rules,catboost.Model)
S3method(extract_rules,cforest)
S3method(extract_rules,cubist)
S3method(extract_rules,grf)
Expand All @@ -32,6 +35,7 @@ S3method(extract_rules,ranger)
S3method(extract_rules,rpart)
S3method(extract_rules,xgb.Booster)
S3method(var_imp,ObliqueForest)
S3method(var_imp,catboost.Model)
S3method(var_imp,cforest)
S3method(var_imp,grf)
S3method(var_imp,lgb.Booster)
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# lorax (development version)

* `active_predictors()`, `as.party()`, `extract_rules()`, and `var_imp()` now have methods for catboost models (`catboost.Model`). Symmetric and non-symmetric trees are supported. Categorical splits, both one-hot and those based on target statistics (CTRs), are converted to sets of factor levels, including CTRs on combinations of features.

* `as.party()` and `extract_rules()` now support lightgbm models with categorical predictors. Category codes are mapped to factor levels using the training data, assuming the codes are `as.integer(factor) - 1L`. `extract_rules()` for lightgbm models gains an optional `data` argument for this; without it, rules use the integer codes.

* `extract_rules()` for lightgbm models now assigns left and right child nodes correctly and compares numeric thresholds as numbers rather than strings.
Expand Down
Loading
Loading