I'm trying to create a model to predict the number of players on a video game at a certain time and was trying to figure out how to integrate categorical data into my forecasting problem. So far, my plan is to use the Steam player count data to train Facebook's Prophet to predict the player numbers. I'm trying to figure out how I can use categorical data, such as if the game is free, to affect this, along with trying to compare with other games. I found out that Prophet has an extra_regressor method that will take an additional time series, predict it, then use that prediction for the main prediction. The problem is, if I tried to use the categories for this, their encodings would be constant and thus useless, and I'm also not comparing across games. Does anybody have any suggestions for how to use this categorical data? Thanks!


1 Answer 1


Not sure if you can predict with many categories.

Nevertheless, some categories could be transformed into numbers that would ease the predictions. For instance, the cost could be converted into 0: Totally Free, 1: Free with pass, 2: less than 10USD, 3: less than 30USD, etc.

(Or just use the average money spent on the game per player, if you have it)

And you can also apply the "other factors" option:

# Python
m = Prophet(weekly_seasonality=False)
m.add_seasonality(name='weekly_on_season', period=7, fourier_order=3, condition_name='on_season')
m.add_seasonality(name='weekly_off_season', period=7, fourier_order=3, condition_name='off_season')

future['on_season'] = future['ds'].apply(is_nfl_season)
future['off_season'] = ~future['ds'].apply(is_nfl_season)
forecast = m.fit(df).predict(future)
fig = m.plot_components(forecast)

Or other regressor:

# Python
def nfl_sunday(ds):
    date = pd.to_datetime(ds)
    if date.weekday() == 6 and (date.month > 8 or date.month < 2):
        return 1
        return 0
df['nfl_sunday'] = df['ds'].apply(nfl_sunday)

m = Prophet()

future['nfl_sunday'] = future['ds'].apply(nfl_sunday)

forecast = m.predict(future)
fig = m.plot_components(forecast)

Source: https://facebook.github.io/prophet/docs/seasonality,_holiday_effects,_and_regressors.html

  • $\begingroup$ Does it answer your question? If not, please let me know to improve it. $\endgroup$ Commented Dec 5, 2022 at 19:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.