Comments (5)
After calling f.auto_forecast()
and before changing the estimator, the scikit-learn trained model is available in the regr
attribute. So, you can use code like this to do what you are asking:
import pickle
xgboost_grid = {
'max_depth': [15],
'tree_method': 'gpu_hist'
}
f.set_estimator('xgboost')
f.ingest_grid(xgboost_grid)
f.tune()
f.auto_forecast()
with open('xgboost_regr.pckl','wb') as pckl:
pickle.dump(f.regr,pckl)
In a separate issue, I think you need brackets around 'gpu_hist'
in the grid. If there is an error with all hyperparam combinations during grid evaluation, the model is trained with default parameters.
from scalecast.
Thanks for the response. I tried your suggested solution but I am having error in the process call it back and use it for predictions.
Error;
ValueError: DataFrame.dtypes for data must be int, float, bool or category. When
categorical type is supplied, DMatrix parameter enable_categorical
must
be set to True
.
Code;
`with open('xgboost_regr.pckl','wb') as pckl:
pickle.dump(f.regr,pckl)
filename = open("xgboost_regr.pckl", "rb")
xgb_new = pickle.load(filename)
filename.close()
pickle_pred = xgb_new.predict(X_test)`
X_test concludes only date time series that i want to make forecast.
from scalecast.
In scalecast, the model is using a whole dataframe of predictors to make forecasts, not just the date-type column. To see the dataframe that is generated for your model, you can run:
f.export_Xvars_df()
You will only be able to use this dataframe to predict one step into the future if you are using any AR terms. You will need to create a process that predicts future values of your AR terms to go more than one step out. But, I think the easiest way to get where you are going is to not pickle out the model and use the forecasts that scalecast produces after running auto_forecast()
by default:
f.auto_forecast()
f.export("lvl_fcsts")
The forecast horizon you specified in your analysis when calling f.generate_future_dates()
will determine how many forecast steps are exported this way. The reason the package both tests and forecasts with the model in the same line of code is to simplify the dynamic process used to make predictions.
from scalecast.
thanks for your response, it helped a lot. 💯
from scalecast.
Glad to help! Closing the issue.
from scalecast.
Related Issues (20)
- Error with Forecaster Attribute 'validation_metric_value' HOT 2
- Return a dataframe for the forecasted future values HOT 3
- Prophet can't be found in grid.py HOT 8
- ForecastError: Need at least 1 Xvar to forecast with the svr model. HOT 3
- How to save model if I also used scalecast to find optimal transformation? HOT 6
- Got Tuple index out of range issue when calling manual_forecast() for rnn HOT 5
- Forecasting using Dates but also Categorical (Exgegenuous) Features HOT 1
- low-level output error generated RuntimeError: Detected a call to `Model.fit` inside a `tf.function`. `Model.fit is a high-level endpoint that manages its own `tf.function`. Please move the call to `Model.fit` outside of all enclosing `tf.function`s. Note that you can call a `Model` directly on `Tensor`s inside a `tf.function` like: `model(x)`. HOT 3
- Silencing Warning and printing HOT 7
- additional regressor for prophet does not work HOT 5
- Implement callbacks on the prophet model.
- Generating new dates / Frequency not understood HOT 9
- Data size impacting tune_test_forecast() and find_optimal_transformation() HOT 3
- `impute_lookback=None` does not work for default `fill_strategy='moving_seasonal_average'` HOT 1
- Forecasts with only Positive values HOT 1
- HWES estimator produces forecasts of much larger magnitude with statsforecast 1.5.0 HOT 2
- Xvars are not found in the current_xreg dict keys HOT 2
- scalecast starter example won't import on mac HOT 3
- How to use best model and transformer from forecaster pipeline on new data without actual y HOT 6
- Feature Imps not storing with Forecaster.tune_test_forecast HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scalecast.