Closed BrianMiner closed 3 years ago
Hi, there,
I just tried your code and got it to work. There was a typo in the param_grid
. I.e., instead of 'et'
you need to use the name of the class in all lowercase. E.g.,
param_grid={
'lasso__alpha': [x/5.0 for x in range(1, 10)],
'extratreesregressor__n_estimators': [10,20],
'ridge__alpha': [x/20.0 for x in range(1, 10)],
'meta-randomforestregressor__n_estimators': [10, 100]
},
If there are multiple instances of the same class used, e.g., 2 ExtraTreeRegressor
s, you would use
'extratreesregressor-1__n_estimators'
, 'extratreesregressor-2__n_estimators'
, etc.
Hope that helps!
Oh that is extremely helpful. The documentation led me to believe that one used the same object names assigned (e.g. 'et' above). Further, the labeling of -1, -2 makes sense I was not sure how to differentiate the same class. Can we assume that -1, -2 etc will correspond to the ordering of the same class objects in the regressors argument - so that if we have
etA = ExtraTreesRegressor(random_state=RANDOM_SEED) etB = ExtraTreesRegressor(random_state=RANDOM_SEED)
stack = StackingCVRegressor(regressors=(lasso, etA, ridge, etB), meta_regressor=rf, use_features_in_secondary=True)
then param_grid={ 'lassoalpha': [x/5.0 for x in range(1, 10)], 'extratreesregressor-1n_estimators': [10,20], 'extratreesregressor-2__n_estimators': [100,1500], 'ridgealpha': [x/20.0 for x in range(1, 10)], 'meta-randomforestregressorn_estimators': [10, 100] },
extratreesregressor-1 then references etA and extratreesregressor-2 references etB?
Can we assume that -1, -2 etc will correspond to the ordering of the same class objects in the regressors argument
Yes, that's correct! Hm, I remember that I documented this somewhere ... Although this issue seems to be "resolved" :), let's leave it open so that I don't forget to double-check where I documented this and also add a note to the StackingCVRegressor
docs
I am trying to modify the example code, by adding on additional regressors. In this case ExtraTrees (same issue with xgboost and randomforest). Am I doing something wrong?