決策樹

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...