[Python] exogene and static features for lightgbm in automlforecast

Discussão em 'Python' iniciado por Stack, Maio 7, 2025.

  1. Stack

    Stack Membro Participativo

    i tried several approaches to implement exogene features in my lightgbm prediction with automlforecast and optuna. I also read the documentation, but i do not find the right positon where to implement static_features = []

    As there are no static_features, all except y, ds and unique_id are handled as dynamic/exogene features.

    Actually with all implementations I get "TypeError: AutoMLForecast.init() got an unexpected keyword argument 'static_features'"

    That is part of my code:

    def my_lgb_config(trial: optuna.Trial):
    return {
    'learning_rate': trial.suggest_float('learning_rate', 0.01, 0.1),
    'verbosity': -1, # keine Infos
    'num_leaves': trial.suggest_int('num_leaves', 2, 2048, log=True),
    'objective': trial.suggest_categorical('objective', ['regression_l1', 'mape','regression', 'huber','fair']),
    'boosting_type': trial.suggest_categorical('boosting_type', ['gbdt', 'dart', 'goss', 'rf']),
    'max_depth': trial.suggest_int('max_depth', 3, 50), #org 3, 12
    'min_child_weight': trial.suggest_float('min_child_weight', 0.001, 10.0),
    'min_child_samples': trial.suggest_int('min_child_samples', 5, 100),
    'subsample': trial.suggest_float('subsample', 0.5, 1.0),
    'colsample_bytree': trial.suggest_float('colsample_bytree', 0.5, 1.0),
    'reg_alpha': trial.suggest_float('reg_alpha', 0.0, 1.0),
    'reg_lambda': trial.suggest_float('reg_lambda', 0.0, 1.0),
    'scale_pos_weight': trial.suggest_float('scale_pos_weight', 0.1, 10.0),
    'n_estimators': trial.suggest_int('n_estimators', 50, 1000), #50, 1000
    'max_bin': trial.suggest_int('max_bin', 100, 500),
    'metric': trial.suggest_categorical('metric',['rmse','mae','mape']),
    #'static_features': trial.suggest_categorical('static_features', [])
    }

    my_lgb = AutoModel(
    model=lgb.LGBMRegressor(random_state=0),
    config=my_lgb_config)

    fcst = AutoMLForecast(
    models={'my_lgb': my_lgb},
    freq='D',
    season_length=7,
    static_features=[],
    )


    Hope you can help me to find the right position.

    thanks in advanced!

    Continue reading...

Compartilhe esta Página