Commit c221c753 authored by Matt Harrison's avatar Matt Harrison
Browse files

updates to split cells and make tree viz work

parent b4bb85a2
Loading
Loading
Loading
Loading
Loading
+1790 −80

File changed.

Preview size limit exceeded, changes collapsed.

+8 −3
Changes for solutions/Supervised ML.py: 8 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -97,11 +97,11 @@ ax.plot(X, X*lr_model.coef_ + lr_model.intercept_+ 100, linestyle='--', color='g

# Vertical distance between line and point is the error. *Ordinary Least Squares* 
# regression tries to minimize the square of the distance.
mean_squared_error(y, pred) 
metrics.mean_squared_error(y, pred) 

# Vertical distance between line and point is the error. *Ordinary Least Squares* 
# regression tries to minimize the square of the distance.
mean_squared_error(y, pred) 
metrics.mean_squared_error(y, pred) 



@@ -305,7 +305,11 @@ dt_model.score(X_test, y_test)

dt_model.predict(X)

tree.plot_tree(dt_model)
fig, ax = plt.subplots(figsize=(10,4))
_ = tree.plot_tree(dt_model, ax=ax, feature_names=X.columns,
               class_names=['Sell', 'Buy'],
               filled=True)


# note that this goes to a Unix path
tree.export_graphviz(dt_model, out_file='/tmp/tree1.dot', 
@@ -429,3 +433,4 @@ classifier.roc_auc(mush_dt, mush_X_train, mush_y_train, mush_X_test, mush_y_test