Rozhodovací stromy

Machine Learning for Finance in Python

Nathan George

Data Science Professor

Rozhodovací stromy

základní rozhodovací strom

Machine Learning for Finance in Python

Rozhodovací stromy

rozhodovací strom s cílovými hodnotami

Machine Learning for Finance in Python

Rozdělení rozhodovacího stromu

kategorické rozdělení rozhodovacího stromu

Machine Learning for Finance in Python

Rozdělení rozhodovacího stromu

numerické rozdělení rozhodovacího stromu

Machine Learning for Finance in Python

Špatný strom

špatný regresní split

Machine Learning for Finance in Python

Dobrý strom

dobrý regresní split

Machine Learning for Finance in Python

Regrese pomocí rozhodovacího stromu

predikce rozhodovacího stromu

Machine Learning for Finance in Python

Regresní stromy

from sklearn.tree import DecisionTreeRegressor

decision_tree = DecisionTreeRegressor(max_depth=5)

decision_tree.fit(train_features, train_targets)
Machine Learning for Finance in Python

Hyperparametry rozhodovacího stromu

maximální hloubka stromu

Machine Learning for Finance in Python

Maximální hloubka 3

rozhodovací strom s maximální hloubkou 3

Machine Learning for Finance in Python

Vyhodnocení modelu

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()
Machine Learning for Finance in Python

predikce vs. skutečné hodnoty

Machine Learning for Finance in Python

Čas na stromy!

Machine Learning for Finance in Python

Preparing Video For Download...