运行 ❯
获取你
自己的 Python
服务器
×
更改方向
更改主题,深色/浅色
转到 Spaces
from sklearn import datasets from sklearn.model_selection import train_test_split from sklearn.ensemble import BaggingClassifier data = datasets.load_wine() X = data.data y = data.target X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.25, random_state = 22) oob_model = BaggingClassifier(n_estimators = 12, oob_score = True,random_state = 22) oob_model.fit(X_train, y_train) print(oob_model.oob_score_)
0.9398496240601504