Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in installing the package "tlverse" #34

Open
JiaqiRen3615 opened this issue Mar 23, 2024 · 1 comment
Open

Error in installing the package "tlverse" #34

JiaqiRen3615 opened this issue Mar 23, 2024 · 1 comment

Comments

@JiaqiRen3615
Copy link

When I tried to install the package "tlverse" following the guide in handbook, I met the following error:

devtools::install_github("tlverse/tlverse")
Using github PAT from envvar GITHUB_PAT. Use gitcreds::gitcreds_set() and unset GITHUB_PAT in .Renviron (or elsewhere) if you want to use the more secure git credential store instead.
Downloading GitHub repo tlverse/tlverse@HEAD
Downloading GitHub repo tlverse/sl3@HEAD
Skipping 1 packages not available: imputeMissings
── R CMD build ────────────────────────────────────────────────────────────────────────────────────────
✔ checking for file ‘/private/var/folders/2w/q3wdqmw51qv5hnlzh8v38yzm0000gn/T/Rtmpf07HCd/remotes1548c2debaab5/tlverse-sl3-6544257/DESCRIPTION’ ...
─ preparing ‘sl3’:
✔ checking DESCRIPTION meta-information ...
─ installing the package to process help pages
-----------------------------------
ERROR: dependency ‘imputeMissings’ is not available for package ‘sl3’
─ removing ‘/private/var/folders/2w/q3wdqmw51qv5hnlzh8v38yzm0000gn/T/RtmpZwcMYJ/Rinst158946ac27ba7/sl3’
-----------------------------------
ERROR: package installation failed
Error: Failed to install 'tlverse' from GitHub:
Failed to install 'sl3' from GitHub:
! System command 'R' failed

I find the core problem is that the package "imputeMissings" is removed from cran! As a result, package "sl3" which relies on it can not be installed.

@JiaqiRen3615
Copy link
Author

This problem can be fixed by just installing the package "imputeMissings" from https://cran.r-project.org/src/contrib/Archive/imputeMissings/. However, I found another problem when testing the code in Chapter 6 "Super Learning". When testing the following code:

----cv-predictions-long------------------------------------------------------

CV predictions "by hand"

for each fold, i, we obtain validation set predictions:

cv_preds_list <- lapply(seq_along(task$folds), function(i){

get validation dataset for fold i:

v_data <- task$data[task$folds[[i]]$validation_set, ]

get observed outcomes in fold i's validation dataset:

v_outcomes <- v_data[["whz"]]

make task (for prediction) using fold i's validation dataset as data,

and keeping all else the same:

v_task <- make_sl3_Task(covariates = task$nodes$covariates, data = v_data)

get predicted outcomes for fold i's validation dataset, using candidates

trained to fold i's training dataset

v_preds <- sl_fit$fit_object$cv_fit$predict_fold(
task = v_task, fold_number = i
)

note: v_preds is a matrix of candidate learner predictions, where the

number of rows is the number of observations in fold i's validation dataset

and the number of columns is the number of candidate learners (excluding

any that might have failed)

an identical way to get v_preds, which is used when we calculate the

cv risk by hand in a later part of this chapter:

v_preds <- sl_fit$fit_object$cv_fit$fit_object$fold_fits[[i]]$predict(

task = v_task

)

we will also return the row indices for fold i's validation set, so we

can later reorder the CV predictions and make sure they are equal to what

we obtained above

return(list("v_preds" = v_preds, "v_index" = task$folds[[i]]$validation_set))
})

Another error arose:
Error in private$.predict(task) : object 'preds' not found
Error in private$.predict(task) : object 'preds' not found
Error in private$.predict(task) : object 'preds' not found
Error in private$.predict(task) : object 'preds' not found
Error in private$.predict(task) : object 'preds' not found
Error in private$.predict(task) : object 'preds' not found
Error in private$.predict(task) : object 'preds' not found
Error in private$.predict(task) : object 'preds' not found
Error in private$.predict(task) : object 'preds' not found
Error in private$.predict(task) : object 'preds' not found

I supposed it dues to some packages or functions used to develop "sl3" have been changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant