Giter VIP home page Giter VIP logo

Comments (1)

rbagd avatar rbagd commented on July 24, 2024 2

It seems that it is currently not supported, which is quite unfortunate but not that hard to extend.

Would a PR to augment Prophet wrapper be acceptable ?

Approach 1

If we follow the approach to exogenous variables as in SARIMA, those are initialized within the parameters already and passed again to the .predict() method.

params = ProphetParams(extra_regressors: pd.DataFrame = regressors_past)
model = ProphetModel(ts_data, params)
model.fit()
model.predict(steps=100, extra_regressors: pd.DataFrame = regressors_future)

so that during fit we would have

for regressor in self.params.extra_regressors:
    prophet.add_regressor(regressor)
df = pd.concat([df, self.params.extra_regressors], axis=1)

Approach 2

A more Prophet-like approach would be to pass regressors as a dictionary with additional parameters similar to how custom seasonalities are implemented.

extra_regressors = [
    {
        "name": "reg1",
     #  "prior_scale", "mode", "standardize" keys are optional
        "value": pd.Series([....]),
    }
]

params = ProphetParams(extra_regressors: List[Dict] = regressors_past)
model = ProphetModel(ts_data, params)
model.fit()
model.predict(steps=100, extra_regressors: List[Dict] = regressors_future)

so that during fit we would have

for regressor in self.params.extra_regressors:
    df = pd.concat([df, regressor.pop("value")], axis=1)
    prophet.add_regressor(**regressor)

I think Kats API should settle on a single way of defining exogenous variables for all models as they are so common in time series prediction.

from kats.

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.