Git Product home page Git Product logo

Comments (5)

mikekeith52 avatar mikekeith52 commented on May 21, 2024

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.

batuhansahincanel avatar batuhansahincanel commented on May 21, 2024

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.

mikekeith52 avatar mikekeith52 commented on May 21, 2024

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.

batuhansahincanel avatar batuhansahincanel commented on May 21, 2024

thanks for your response, it helped a lot. 💯

from scalecast.

mikekeith52 avatar mikekeith52 commented on May 21, 2024

Glad to help! Closing the issue.

from scalecast.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.