Pythonで学ぶ木ベースのMachine Learning
Elie Kawerk
Data Scientist
第1章: Classification And Regression Tree (CART)
第2章: バイアス–バリアンスのトレードオフ
第3章: バギングとランダムフォレスト
第4章: ブースティング
第5章: モデルチューニング
個々の特徴に対する if-else の連続。
目的: クラスラベルを推定。
特徴とラベルの非線形関係を捉えられる。
特徴量スケーリング不要(例: Standardization など)


# Import DecisionTreeClassifier from sklearn.tree import DecisionTreeClassifier # Import train_test_split from sklearn.model_selection import train_test_split # Import accuracy_score from sklearn.metrics import accuracy_score# Split the dataset into 80% train, 20% test X_train, X_test, y_train, y_test= train_test_split(X, y, test_size=0.2, stratify=y, random_state=1)# Instantiate dt dt = DecisionTreeClassifier(max_depth=2, random_state=1)
# Fit dt to the training set dt.fit(X_train,y_train) # Predict the test set labels y_pred = dt.predict(X_test)# Evaluate the test-set accuracy accuracy_score(y_test, y_pred)
0.90350877192982459
判定領域: 特徴空間で、全インスタンスが同一クラスに割り当てられる領域。
判定境界: 異なる判定領域を分ける境界面。


Pythonで学ぶ木ベースのMachine Learning