Slackbot
10/02/2023, 4:32 PMJosé Morales
10/02/2023, 4:45 PMfrom sklearn.compose import ColumnTransformer
from sklearn.linear_model import LinearRegression
from sklearn.pipeline import make_pipeline
ohe = ColumnTransformer([('unique_id', OneHotEncoder(sparse_output=False))], remainder='passthrough')
ohe_lr = make_pipeline(ohe, LinearRegression())
fcst = MLForecast(models=ohe_lr, ...)
fcst.fit(..., static_features=['unique_id', ...])
Or if your model supports categorical features (like LightGBM) you can just provide the id as a static feature directly (having the id with a categorical dtype)José Morales
10/02/2023, 4:50 PMJason Gofford
10/02/2023, 4:53 PM