categorical variables #139
Replies: 7 comments 2 replies
-
Moreover, when are you estimating multi-variable forecasts to be available? |
Beta Was this translation helpful? Give feedback.
-
Hi Matthew, Thank you for reporting this issue. Officially, the model does not support categorical variables, as that would not work with concepts such as tend and seasonality in their original sense. In your case, as you only have one category, you should be able to model it as a binary series. Try if setting Would you mind providing some example data and a minimal code example for us to reproduce the issue? Re: Multi-Variable forecasts: While it is something we plan to support, we currently do not have a planned date, as it would require a restructuring of larger parts of the API, particularly for plotting. However, If you would like to implement it, I would be happy to chat with you to see how we could best achieve that. |
Beta Was this translation helpful? Give feedback.
-
@ourownstory Hi thanks for getting back to me! By not supporting categorical variables, what do you mean exactly? Given your suggestion to model a single category as a binary series, do you just mean not able to support multiple categorical variables (as opposed to one as the the target variable to predict or even as a single feature in the model)? Unfortunately the data is sensitive, but it's essentially a time series (with many other features that I discarded for the purpose of using only the time series and the target binary variable to forecast). If there were a multi-variable approach available, I would include the rest of these features. However, X_train in my example above essentially has 2 columns ('date' where this is formatted as 0, 1, 2, etc and not as a datetime, and then 'y' which is the binary variable I am trying to forecast as '1' or '0') Completely understand regarding the multi-variable forecasts. I would be happy to contribute to the implementation of this, where would be the best place to start? |
Beta Was this translation helpful? Give feedback.
-
Hi @mturk24, Solution with existing codeCategorical variables: as targetAs target variable ( If you had more categories (e.g. 3), you could only simplify it to a single dimensional numerical variable if they have an order and an attributable numeric value (e.g. Categorical variables: as regressorsYou should be able to use the majority of the additional features as inputs with our existing functionality. You could write a simple helper function to do this for multi-categorical variables. It would not be the most elegant solution, but get the job done. Non-datetime input dataCurrently, the best approach is to simply map it to some random series of datestamps, as you seem to have been doing. Creating a better SolutionCategorical variables: as regressorsThis should be rather straight forward. When adding a regressor, an arg could specify it's a categorical variable, and how many categories there are. Then, the supplied category indexes Categorical variables: as targetThis would be a bit more involved, and might actually be best implemented in conjunction with a multi-varible forecast, as it's essentially the same, just with a different loss function. Non-datetime input dataProper support for this has been on our roadmap for a while (tracked as issue #18 ). |
Beta Was this translation helpful? Give feedback.
-
@ourownstory Thank you for the detailed response, that is very helpful and I very much appreciate it! Do you have a simple example of code where you are using a binary categorical variable as a target (with only 2 values, 0 or 1) with just a time series to go along with it (as the feature space, technically)? I still haven't gotten my code to run properly, and I just want to sanity check against something that satisfies this use case. I haven't found anything in the notebook examples or elsewhere to sanity check against. |
Beta Was this translation helpful? Give feedback.
-
@mturk24 Dataset: As is-inflow/ is-outflow As game-happening or count>x If you end up creating an example notebook it would be great if you could contribute it to the repo. Finally, just to be sure I understand: You are not trying to do time-series classification, but forecasting, right? |
Beta Was this translation helpful? Give feedback.
-
Converted this issue to a discussion and added issues #191, #192 and #193. |
Beta Was this translation helpful? Give feedback.
-
Hi there, if I am trying to forecast a categorical variable "y" that has values 1 and 0 (1 = take action, 0 = don't take action) with just the time series "ds" and "y" as input, I'm getting an error when observing my model fitted results on default parameters for both the neural prophet object and my fit method call.
My fit method looks like the following:
model.fit(X_train, freq='D')
However, my output looks like the below
Would you be able to provide a simple example of fitting a model on a categorical variable?
Beta Was this translation helpful? Give feedback.
All reactions