import numpy as np
from sklearn.pipeline import Pipeline
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import PolynomialFeatures
from sklearn.preprocessing import StandardScaler
from sklearn.metrics import mean_squared_error
from sklearn.linear_model import LogisticRegression
from sklearn import datasets
from sklearn.svm import SVC
from sklearn.ensemble import VotingClassifier
from sklearn.tree import DecisionTreeClassifier
from sklearn.ensemble import BaggingClassifier,RandomForestClassifier,ExtraTreesClassifier
X,y=datasets.make_moons(n_samples=500,noise=0.3,random_state=666)
# train_X,test_X,train_y,test_y = train_test_split(X,y,test_size=0.2,random_state=666)
rf_clf=ExtraTreesClassifier(n_estimators=500,bootstrap=True,random_state=666,oob_score=True,n_jobs=-1)
rf_clf.fit(X,y)
print(rf_clf.oob_score_)
# print(dt_reg.score(train_X, train_y))
随机森林 extra-trees
最新推荐文章于 2024-08-16 20:16:36 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)