Skip to content

Commit

Permalink
avoid errors in vignettes, install packages from source
Browse files Browse the repository at this point in the history
  • Loading branch information
jameslamb committed Dec 2, 2024
1 parent d031220 commit 02b83e5
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/r_revdepchecks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
brew install libomp
- name: build package
run: |
Rscript -e "install.packages(c('R6', 'data.table', 'jsonlite', 'knitr', 'markdown', 'Matrix', 'RhpcBLASctl'), repos = 'https://cran.r-project.org', Ncpus = parallel::detectCores())"
Rscript -e "install.packages(c('R6', 'data.table', 'jsonlite', 'knitr', 'markdown', 'Matrix', 'RhpcBLASctl'), repos = 'https://cran.r-project.org', Ncpus = parallel::detectCores(), type = 'binary')"
sh ./build-cran-package.sh
- name: run revdepchecks
run: |
Expand Down
2 changes: 1 addition & 1 deletion R-package/R/lgb.train.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ lgb.train <- function(params = list(),
reset_data = FALSE,
serializable = TRUE) {

stop("THIS IS THE LIFE BAH-DUM BAH-DUM-DUM")
stop("THIS IS AN ERROR FOR TESTING")

# validate inputs early to avoid unnecessary computation
if (nrounds <= 0L) {
Expand Down
24 changes: 0 additions & 24 deletions R-package/vignettes/basic_walkthrough.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -67,22 +67,6 @@ In a first step, you need to convert data to numeric. Afterwards, you are ready
# Numeric response and feature matrix
y <- as.numeric(bank$y == "yes")
X <- data.matrix(bank[, c("age", "balance")])
# Train
fit <- lightgbm(
data = X
, label = y
, params = list(
num_leaves = 4L
, learning_rate = 1.0
, objective = "binary"
)
, nrounds = 10L
, verbose = -1L
)
# Result
summary(predict(fit, X))
```

It seems to have worked! And the predictions are indeed probabilities between 0 and 1.
Expand All @@ -101,14 +85,6 @@ params <- list(
, num_leaves = 4L
, learning_rate = 1.0
)
# Train
fit <- lgb.train(
params
, data = dtrain
, nrounds = 10L
, verbose = -1L
)
```

Try it out! If stuck, visit LightGBM's [documentation](https://lightgbm.readthedocs.io/en/latest/R/index.html) for more details.
Expand Down

0 comments on commit 02b83e5

Please sign in to comment.