You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I used to predict new data with a trained model (lrn.rf) in mlr3 0.18.0 using the following code, and it worked fine. However, when I use the same code in mlr3 0.20.0, I receive the error: "Error: Setting row roles 'test'/'holdout' is no longer possible."
How can I predict new data without a target in mlr3 0.20.0?
I see that you load a learner from disk. I assume this learner was created with an older mlr3 version? If you train the model with the version you are predicting with, there should be no problems. The error message points to a recent change in mlr3.
I see that you load a learner from disk. I assume this learner was created with an older mlr3 version? If you train the model with the version you are predicting with, there should be no problems. The error message points to a recent change in mlr3.
Thank you!I have solved this problem after retraining the model.
I recently updated mlr3 to the latest version.
I used to predict new data with a trained model (lrn.rf) in mlr3 0.18.0 using the following code, and it worked fine. However, when I use the same code in mlr3 0.20.0, I receive the error: "Error: Setting row roles 'test'/'holdout' is no longer possible."
How can I predict new data without a target in mlr3 0.20.0?
Thank you!
lrn.rf <- readRDS('./aHCC-ML/tuned_RandomForest_model.rds')
dd <- data.frame( target = NA, Sex = 'Female', Age = 80, HBsAg = 'Positive', PLT = 44, AST = 20, AFP = 20, stringsAsFactors = FALSE ) |> as_tibble() |> mutate( HBsAg = case_when( HBsAg == 'Positive' ~ '1', HBsAg == 'Negative' ~ '0' ), Sex = case_when( Sex == 'Female' ~ '1', Sex == 'Male' ~ '0' ) ) |> mutate(across(c(Sex, HBsAg), factor))
res <- predict(lrn.rf, dd, predict_type = "prob")
Error: Setting row roles 'test'/'holdout' is no longer possible.
task <- TaskClassif$new("test", backend = dd, target = "target")
Error: Target column 'target' must be a factor or ordered factor
The text was updated successfully, but these errors were encountered: