Closed amitk1993 closed 2 months ago
Right now there is no formal function to create an updated forecast with previously trained models and new data. It's on the roadmap but we're prioritizing model accuracy+interpretability first.
You can load the trained models yourself using the get_trained_models() function. Then you could manually connect those trained models with updated data after running the prep_data() function. Not super streamlined but should get you what you need in the meantime.
https://microsoft.github.io/finnts/reference/get_trained_models.html
Hi @mitokic
Thanks for your response. get_trained_models() returns a table of trained models but I need to save/dump best trained model as pickle/rds file... Then I can load that file and pass the unseen data for predictions.
Want to replicate the same process which we follows in model development.
# Example: Saving a linear model as .rds model <- lm(mpg ~ wt + hp, data = mtcars)
-# Save the model to an .rds file saveRDS(model, file = @"linear_model.rds")
-# Load the model from the .rds file model <- readRDS("linear_model.rds")
-# Load the necessary library library(datasets)
-# Example new data for prediction new_data <- data.frame(wt = c(3.0, 3.5), hp = c(120, 150))
-# Make predictions using the loaded model predictions <- predict(model, newdata = new_data)
-# Print predictions print(predictions)
The trained models are already saved as RDS files on disk. By default finnts always saves each stage of the forecast process to disk. So the "get_trained_models()" function just reads the saved models that were already saved as RDS files and brings them into memory.
You can always take the trained models and save them somewhere else if you'd like. But you'd have to do that yourself manually.
Use "get_forecast_data()" to see what was the best model for each time series. Which says so under the "best model" column and "model id" column. Then you can pull that specific trained model and do whatever you want with it. Eventually we will label the best model when running "get_trained_models()" but it's not a top priority right now. Instead we are prioritizing model interpretability first.
I am unable to find any functions to save/dump the trained model so that I can load/use it later for further predictions.