luke14free / pm-prophet

GAM timeseries modeling with auto-changepoint detection. Inspired by Facebook Prophet and implemented in PyMC3
325 stars 42 forks source link

Categorical Variables #27

Closed Sandy4321 closed 3 years ago

Sandy4321 commented 3 years ago

can you package work with multivariate categorical time series and multivariate time series when some features are categorical and some some features are continues

luke14free commented 3 years ago

I can't really understand your question :-) can you provide some details?

Sandy4321 commented 3 years ago

lets start from easier question can you package work with multivariate time series for example sagemaker can do it by " training a single model jointly over all of the time series" just check deepAR https://docs.aws.amazon.com/sagemaker/latest/dg/deepar.html In many applications, however, you have many similar time series across a set of cross-sectional units. For example, you might have time series groupings for demand for different products, server loads, and requests for webpages. For this type of application, you can benefit from training a single model jointly over all of the time series. DeepAR takes this approach. When your dataset contains hundreds of related time series, DeepAR outperforms the standard ARIMA and ETS methods. You can also use the trained model to generate forecasts for new time series that are similar to the ones it has been trained on

luke14free commented 3 years ago

you can definitely add multiple regressors using m.add_regressor(regressor). If you want to transform categorical variables to dummy variables which you can then use in pmprophet simply use https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.get_dummies.html over your dataframe and then use m.add_regressors as required.

Sandy4321 commented 3 years ago

Great 1 Do you have code example with multiple regressors? Tutorial? 2 Can you share link to algorithm. Description how you combine multiple regressors?

Sandy4321 commented 3 years ago

1 also can it do something more complicated than just linear combination of regressors ? y(t) = trend(t) + seasonality(t) + beta1 regressor1(t) + beta2 regressor2(t) + ... 2 what to do with categorical features ? like mentioned by https://github.com/bletham in https://github.com/facebook/prophet/issues/1583 "and I wouldn't expect a linear model to work very well for categorical features."

Sandy4321 commented 3 years ago

2 what to do with categorical features ? like mentioned by @bletham in facebook/prophet#1583 "and I wouldn't expect a linear model to work very well for categorical features."

luke14free commented 3 years ago

Please don't open multiple issues for the same thing. Linear models don't indeed work well with categorical features (you'd need something like random forests or decision trees like xgboost for that). You can transform categorical variables in dummies (which will make the number of regressors grow) if you really want to use categoricals, but I see very little use for this. Please refer to the example in home page to use this package.