決定木

Python による金融のための Machine Learning

Nathan George

Data Science Professor

決定木

基本的な決定木

Python による金融のための Machine Learning

決定木

目的変数付き決定木

Python による金融のための Machine Learning

決定木の分割

カテゴリ変数による分割

Python による金融のための Machine Learning

決定木の分割

数値変数による分割

Python による金融のための Machine Learning

悪い木

悪い回帰分割

Python による金融のための Machine Learning

良い木

良い回帰分割

Python による金融のための Machine Learning

決定木による回帰

決定木の予測

Python による金融のための Machine Learning

回帰木

from sklearn.tree import DecisionTreeRegressor

decision_tree = DecisionTreeRegressor(max_depth=5)

decision_tree.fit(train_features, train_targets)
Python による金融のための Machine Learning

決定木のハイパーパラメータ

木の最大深さ

Python による金融のための Machine Learning

最大深さ3

最大深さ3の決定木

Python による金融のための Machine Learning

モデルの評価

print(decision_tree.score(train_features, train_targets))
print(decision_tree.score(test_features, test_targets))
0.6662215501032416
-0.08917300191734268
train_predictions = decision_tree.predict(train_features)
test_predictions = decision_tree.predict(test_features)
plt.scatter(train_predictions, train_targets, label='train')
plt.scatter(test_predictions, test_targets, label='test')
plt.legend()
plt.show()
Python による金融のための Machine Learning

予測値と実際の値

Python による金融のための Machine Learning

決定木を構築しましょう!

Python による金融のための Machine Learning

Preparing Video For Download...