如何使BaggingRegressor可重复

时间:2018-03-14 21:28:16

标签: python-3.x scikit-learn neural-network ensemble-learning

有人可以告诉我为什么尽管有大量的bootstrap样本,但结果与此代码的两次发布有很大不同:

from sklearn.ensemble import BaggingRegressor
from sklearn.neural_network import MLPRegressor

estimator =  BaggingRegressor(MLPRegressor(),max_samples =10000,max_features=6)
X_train = X_train[['zkurt','zmean','zscale','zshape','zskew','zvar1']]
y_train = y_train[['vary']]
X_test  = X_test[['zkurt','zmean','zscale','zshape','zskew','zvar1']]
y_test  = y_test[['vary']]
estimator.fit(X_train, y_train.values.ravel())
y_predict = estimator.predict(X_test)
r2=estimator.score(X_test, y_test.values.ravel())

预测和r2从一个发射器到另一个发射器变化很大。

感谢您的帮助。

0 个答案:

没有答案