tutorial scikit modelos machine libro librería learning learn inteligencia español ejemplos ejemplo artificial scikit-learn pipeline mlxtend

scikit-learn - scikit - python machine learning ejemplos



Error en regresor de votación mlxtend al usar bosque aleatorio para la selección de características (0)

from mlxtend.regressor import StackingRegressor from sklearn.ensemble.forest import RandomForestRegressor as RFR from sklearn.ensemble import GradientBoostingRegressor as GBR import xgboost as xgb rfr = RFR(n_estimators=500, n_jobs=cc.ncpu, random_state=0) gbr = GBR(n_estimators=1000, random_state=0) xgr = xgb.XGBRegressor() mtr = RFR() # meta regressor regressors = [rfr, gbr, xgr] model = StackingRegressor(regressors=regressors, meta_regressor=mtr) param_grid = { ''fs__threshold'': [''median''], ''fs__estimator__max_features'': [''log2''], ''clf__rfr__max_features'': [''auto'', ''log2''], ''clf__gbr__learning_rate'': [0.05, 0.02, 0.01], ''clf__gbr__max_depth'': [4, 5, 6, 7], ''clf__gbr__max_features'': [''auto'', ''log2''], ''clf__gbr__n_estimators'': [500, 1000, 2000], ''clf__xgr__learning_rate'': [0.001, 0.05, 0.1, 0.2], ''clf__xgr__max_depth'': [2, 4, 6], ''clf__xgr__min_child_weight'': [1, 3, 5], ''clf__xgr__n_estimators'': [500, 1000], ''clf__meta-mtr__n_estimators'': [750, 1500] } rf_feature_imp = RFR(250, n_jobs=cc.ncpu) feat_selection = SelectFromModel(rf_feature_imp) pipeline = Pipeline([(''fs'', feat_selection), (''clf'', model), ]) gs = GridSearchCV(pipeline, param_grid=param_grid, verbose=1, n_jobs=-1, error_score=np.nan)

En el código anterior, quiero usar el regresor de votación mlxtend y también usar un bosque aleatorio para seleccionar las características relevantes. Sin embargo, este código no funciona y recibo un error

ValueError: Invalid parameter xgr for estimator StackingRegressor(meta_regressor=RandomForestRegressor(bootstrap=True, criterion=''mse'', max_depth=None, max_features=''auto'', max_leaf_nodes=None, min_impurity_split=1e-07, min_samples_leaf=1, min_samples_split=2, min_weight_fraction_leaf=0.0, n_estimators=10, n_jobs=1, oob_score=False, random_state=None, verbose=0, warm_start=False), regressors=[RandomForestRegressor(bootstrap=True, criterion=''mse'', max_depth=None, max_features=''auto'', max_leaf_nodes=None, min_impurity_split=1e-07, min_samples_leaf=1, min_samples_split=2, min_weight_fraction_leaf=0.0, n_estimators=500, n_jobs=5, oob_sc...eg:linear'', reg_alpha=0, reg_lambda=1, scale_pos_weight=1, seed=0, silent=True, subsample=1)], verbose=0). Check the list of available parameters with `estimator.get_params().keys()`.

¿Cómo arreglar esto?