我想使用带有 XGBoost 和 Mlpregression 的 bagging 如果我使用一种算法,它将正常工作
XGBRegressor_bagging_model = BaggingRegressor(XGBRegressor_model,
n_estimators=100,
max_samples=1.0,
max_features=1.0,
bootstrap=True,
oob_score=True,
warm_start=False,
n_jobs=-1,
verbose=0)
MLP = BaggingRegressor(MLPRegressor_Model,
n_estimators=1000,
max_samples=1.0,
max_features=1.0,
bootstrap=True,
oob_score=True,
warm_start=False,
n_jobs=-1,
verbose=0)
XGBRegressor_bagging_model.fit(X_train, y_train)
MLP.fit(X_train, y_train)
print("XGBRegressor_bagging_model Predicted Is:", XGBRegressor_bagging_model.predict(X_test)[0:5])
print("MLP Predicted Is:", MLP.predict(X_test)[0:5])
print("XGBRegressor_bagging_model Score Is:", XGBRegressor_bagging_model.oob_score_)
print("MLP Score Is:", MLP.oob_score_)
但如果我这样使用它
bagging_model = BaggingRegressor((XGBRegressor_model, MLPRegressor_Model), n_estimators=100,max_samples=1.0, max_features=1.0, bootstrap=True, oob_score=True, warm_start=False, n_jobs=-1, verbose=0)
它不起作用并向我显示此错误
AttributeError: 'tuple' object has no attribute 'fit'
我应该怎么做才能解决这个问题?