Closed Leprechault closed 3 months ago
Hi, if you want to save a particular object from the output, instead of the full train() outcome you have to do the following steps:
Alternatively you could ommit the first step.
model <- cc_model$models_list$decision_tree_RS_9
saveRDS(model, file = "model.RData")
x <- readRDS("model.RData")
# Alternatively
saveRDS(cc_model$models_list$decision_tree_RS_9, file = "model.RData")
Unfortunately, @HubertR21 doesn't work, I try and the output is:
model <- cc_model$models_list$decision_tree_RS_9
saveRDS(model, file = "model.RData")
x <- readRDS("model.RData")
test_predictions <- predict_new(x,data_test_f)
Error in if (type == "binary_clf") {
I checked the data_test_f
object, and all the variables look likes OK and work with test_predictions <- predict_new(cc_model,data_test_f)
Okay, I see where the issue is. If you want to just save the model and use it in a standalone way, fine-tune it, etc then the following method works. But if you also want the access to other forester features, like the aforementioned predict_new() then you need whole object.
The reason for that is the fact that in case of predicting new variables, we have to ensure that the incoming data will be processed in exactly the same way as the ones trained before.
Thanks for the issue, as now I see an opportunity for improvement where the user can can select a single model to predict!
Thank you, @HubertR21, for your support. I would like to request that in the future, you consider selecting a single model. When I try to open the complete train
object, it uses up 45GB of RAM, which makes it difficult to use the forest model within a Shinny dashboard. This causes me to use an expensive cloud VM, which is not ideal.
Hello again @Leprechault. Just a while age we've released a new package version, where I've added the requested feature. I hope, you will find it useful!
Thanks very much!!
Please, I need help. After the better
forester
models adjustment, I save the model using:But I just need to store just the
decision_tree_RS_9
model and not all models in cc_ml_v16.rds RDS object.Please, any help with it?