I'm using lightgbm with sklearn stacking method, but I encounter a problem which is :
How can I setting some parameters in LGBMRegressor.fit function?
This is my code for now :
from sklearn.datasets import load_diabetes
from sklearn.linear_model import RidgeCV
from sklearn.svm import LinearSVR
from sklearn.ensemble import RandomForestRegressor
from sklearn.ensemble import StackingRegressor
from lightgbm import LGBMRegressor
X, y = load_diabetes(return_X_y=True)
estimators = [
('lr', RidgeCV()),
('svr', LinearSVR(random_state=42)),
('lgb', LGBMRegressor())
]
reg = StackingRegressor(
estimators=estimators,
final_estimator=RandomForestRegressor(n_estimators=10,
random_state=42)
)
reg.fit(X,Y)
But I want to set num_boost_round and early_stopping_rounds in LGBMRegressor.fit, how can I achieve that when I used with StackingRegressor.fit
※Note : Without using stacking method, I can implement with
lgb = LGBMRegressor()
lgb.fit(X,Y, num_boost_round=20000, early_stopping_rounds=1000)