我想知道如何解决这个错误。我尝试在 R 中运行以下代码:
library("DALEX")
library(shapper)
library("randomForest")
set.seed(123)
model_rf <- randomForest(x = exprs_fullmodel, y = group2)
p_function <- function(model, data) predict(model, newdata = data, type = "prob")
ive_rf <- individual_variable_effect(model_rf, data = exprs_fullmodel, predict_function = p_function, new_observation = exprs_fullmodel[1:2,], nsamples = 40)
我收到以下错误:
Regressors in active set degenerate. Dropping a regressor, after 12 iterations, i.e. alpha=3.990e-03, with an active set of 12 regressors, and the smallest cholesky pivot element being 2.107e-08. Reduce max_iter or increase eps parameters.
Early stopping the lars path, as the residues are small and the current value of alpha is no longer well controlled. 22 iterations, alpha=4.896e-03, previous alpha=4.484e-03, with an active set of 13 regressors.
100%|##########| 2/2 [00:00<00:00, 2.16it/s]Error in 1:nrow(new_data) : argument of length 0
In addition: Warning message:
In new_data$`_id_` <- c(1:nrow(new_data)) : Coercing LHS to a list
################################################# ##########################我的df的结构是:
str(exprs_fullmodel)
num [1:40, 1:196] -242725 664323 205022 361526 50264 ...
- attr(*, "dimnames")=List of 2
..$ : chr [1:40] "ID_1" "ID_2" "ID_3" "ID_4" ...
..$ : chr [1:196] "RP_neg_502_8606a15_343" "RP_neg_509_3864a10_653" "RP_neg_181_0508a3_017" "HILIC_pos_729_5911a0_959" ...
str(group2)
Factor w/ 2 levels "control","test": 2 1 1 1 1 2 1 1 2 1 ...
请让我知道如何解决此错误。