ランダムフォレスト
勉強中です。
ランダムフォレストsklearn
from sklearn.datasets import load_iris from sklearn.model_selection import train_test_split X = load_iris().data y = load_iris().target X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=1) from sklearn.ensemble import RandomForestClassifier forest = RandomForestClassifier(criterion='gini', n_estimators=25, random_state=1, n_jobs=2) forest.fit(X_train, y_train) accuracy_score(forest.predict(X_test), y_test)