Hey everyone, quick question about MLForecast: Is ...
# general
Hey everyone, quick question about MLForecast: Is there a way to utilize LightGBM's categorical features: https://lightgbm.readthedocs.io/en/latest/Advanced-Topics.html . Specifically for the unique id column? Thanks!
hey @Tyler Blume! Thanks for using MLForecast. Yes, you can pass your categorial columns as
type and the sklearn API of lightgbm (
) will handle them by default. Also if you want to use the
as a static variable, you need to create a separate column. And to use it as a categorical feature you need to convert it to
Here’s an example (
already is of type
Copy code
import lightgbm as lgb
from mlforecast import MLForecast
from mlforecast.utils import generate_daily_series

series = generate_daily_series(100, equal_ends=True, n_static_features=2, static_as_categorical=True)

series['my_id_col'] = series['unique_id'].copy()

mlf = MLForecast(
mlf.fit(series, static_features=['my_id_col', 'static_0', 'static_1'])

preds = mlf.predict(12)
This is what the series dataframe looks like:
Hey @fede (nixtla) (they/them) awesome thanks so much. Any plans to make using the id column default behavior? Using a categorical id a long with scaling at the time series level (boxcox, standard, minmax) gives nice performance boosts!
hey @Tyler Blume! Could you help us open an issue to include that behavior? https://github.com/Nixtla/mlforecast/issues/new/choose Thank you!
hey @fede (nixtla) (they/them) sorry it took so long to get around to this but I have opened a couple of issues up. I also wrote a wrapper a little while back that does a lot of what I see gives good performance boosts. It only uses LightGBM but it adds some other features that make it a little easier to tune (in my experience) I pushed it to github if interested!
🙌 1
âś… 1
This is really cool, @Tyler Blume! wdyt @José Morales? maybe we could include some of these features natively in mlforecast, would you like to contribute to that @Tyler Blume? 🎉
Yeah sounds good to me!
@José Morales let me know if you want me to work on adding these. They are also pretty easy code snippets so we could just jump on a call and I could review them and you could add them. Whatever works best for you!
If you have time to open a PR that'd be great. I think you can create a new module with these features. Let us know if you need help, nbdev takes some time to getting used to
đź‘Ť 1