small typos again
This commit is contained in:
@@ -152,22 +152,6 @@ MathJax.Hub.Config({
|
||||
<!-- !split -->
|
||||
|
||||
<h2 id="___sec14" class="anchor">Playing around with regions </h2>
|
||||
|
||||
<p>
|
||||
|
||||
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
|
||||
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span></span>angle <span style="color: #666666">=</span> np<span style="color: #666666">.</span>pi <span style="color: #666666">/</span> <span style="color: #666666">180</span> <span style="color: #666666">*</span> <span style="color: #666666">20</span>
|
||||
rotation_matrix <span style="color: #666666">=</span> np<span style="color: #666666">.</span>array([[np<span style="color: #666666">.</span>cos(angle), <span style="color: #666666">-</span>np<span style="color: #666666">.</span>sin(angle)], [np<span style="color: #666666">.</span>sin(angle), np<span style="color: #666666">.</span>cos(angle)]])
|
||||
Xr <span style="color: #666666">=</span> X<span style="color: #666666">.</span>dot(rotation_matrix)
|
||||
|
||||
tree_clf_r <span style="color: #666666">=</span> DecisionTreeClassifier(random_state<span style="color: #666666">=42</span>)
|
||||
tree_clf_r<span style="color: #666666">.</span>fit(Xr, y)
|
||||
|
||||
plt<span style="color: #666666">.</span>figure(figsize<span style="color: #666666">=</span>(<span style="color: #666666">8</span>, <span style="color: #666666">3</span>))
|
||||
plot_decision_boundary(tree_clf_r, Xr, y, axes<span style="color: #666666">=</span>[<span style="color: #666666">0.5</span>, <span style="color: #666666">7.5</span>, <span style="color: #666666">-1.0</span>, <span style="color: #666666">1</span>], iris<span style="color: #666666">=</span><span style="color: #008000">False</span>)
|
||||
|
||||
plt<span style="color: #666666">.</span>show()
|
||||
</pre></div>
|
||||
<p>
|
||||
|
||||
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
|
||||
|
||||
@@ -224,7 +224,6 @@ plt<span style="color: #666666">.</span>axis([<span style="color: #666666">0</sp
|
||||
plt<span style="color: #666666">.</span>xlabel(<span style="color: #BA2121">"$x_1$"</span>, fontsize<span style="color: #666666">=18</span>)
|
||||
plt<span style="color: #666666">.</span>title(<span style="color: #BA2121">"min_samples_leaf={}"</span><span style="color: #666666">.</span>format(tree_reg2<span style="color: #666666">.</span>min_samples_leaf), fontsize<span style="color: #666666">=14</span>)
|
||||
|
||||
save_fig(<span style="color: #BA2121">"tree_regression_regularization_plot"</span>)
|
||||
plt<span style="color: #666666">.</span>show()
|
||||
</pre></div>
|
||||
<p>
|
||||
|
||||
@@ -727,22 +727,6 @@ plt.show()
|
||||
|
||||
<section>
|
||||
<h2 id="___sec14">Playing around with regions </h2>
|
||||
|
||||
<p>
|
||||
|
||||
<!-- code=python (!bc pycod) typeset with pygments style "perldoc" -->
|
||||
<div class="highlight" style="background: #eeeedd"><pre style="font-size: 80%; line-height: 125%"><span></span>angle = np.pi / <span style="color: #B452CD">180</span> * <span style="color: #B452CD">20</span>
|
||||
rotation_matrix = np.array([[np.cos(angle), -np.sin(angle)], [np.sin(angle), np.cos(angle)]])
|
||||
Xr = X.dot(rotation_matrix)
|
||||
|
||||
tree_clf_r = DecisionTreeClassifier(random_state=<span style="color: #B452CD">42</span>)
|
||||
tree_clf_r.fit(Xr, y)
|
||||
|
||||
plt.figure(figsize=(<span style="color: #B452CD">8</span>, <span style="color: #B452CD">3</span>))
|
||||
plot_decision_boundary(tree_clf_r, Xr, y, axes=[<span style="color: #B452CD">0.5</span>, <span style="color: #B452CD">7.5</span>, -<span style="color: #B452CD">1.0</span>, <span style="color: #B452CD">1</span>], iris=<span style="color: #658b00">False</span>)
|
||||
|
||||
plt.show()
|
||||
</pre></div>
|
||||
<p>
|
||||
|
||||
<!-- code=python (!bc pycod) typeset with pygments style "perldoc" -->
|
||||
@@ -867,7 +851,6 @@ plt.axis([<span style="color: #B452CD">0</span>, <span style="color: #B452CD">1<
|
||||
plt.xlabel(<span style="color: #CD5555">"$x_1$"</span>, fontsize=<span style="color: #B452CD">18</span>)
|
||||
plt.title(<span style="color: #CD5555">"min_samples_leaf={}"</span>.format(tree_reg2.min_samples_leaf), fontsize=<span style="color: #B452CD">14</span>)
|
||||
|
||||
save_fig(<span style="color: #CD5555">"tree_regression_regularization_plot"</span>)
|
||||
plt.show()
|
||||
</pre></div>
|
||||
</section>
|
||||
|
||||
@@ -693,22 +693,6 @@ plt.show()
|
||||
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
|
||||
|
||||
<h2 id="___sec14">Playing around with regions </h2>
|
||||
|
||||
<p>
|
||||
|
||||
<!-- code=python (!bc pycod) typeset with pygments style "perldoc" -->
|
||||
<div class="highlight" style="background: #eeeedd"><pre style="line-height: 125%"><span></span>angle = np.pi / <span style="color: #B452CD">180</span> * <span style="color: #B452CD">20</span>
|
||||
rotation_matrix = np.array([[np.cos(angle), -np.sin(angle)], [np.sin(angle), np.cos(angle)]])
|
||||
Xr = X.dot(rotation_matrix)
|
||||
|
||||
tree_clf_r = DecisionTreeClassifier(random_state=<span style="color: #B452CD">42</span>)
|
||||
tree_clf_r.fit(Xr, y)
|
||||
|
||||
plt.figure(figsize=(<span style="color: #B452CD">8</span>, <span style="color: #B452CD">3</span>))
|
||||
plot_decision_boundary(tree_clf_r, Xr, y, axes=[<span style="color: #B452CD">0.5</span>, <span style="color: #B452CD">7.5</span>, -<span style="color: #B452CD">1.0</span>, <span style="color: #B452CD">1</span>], iris=<span style="color: #658b00">False</span>)
|
||||
|
||||
plt.show()
|
||||
</pre></div>
|
||||
<p>
|
||||
|
||||
<!-- code=python (!bc pycod) typeset with pygments style "perldoc" -->
|
||||
@@ -831,7 +815,6 @@ plt.axis([<span style="color: #B452CD">0</span>, <span style="color: #B452CD">1<
|
||||
plt.xlabel(<span style="color: #CD5555">"$x_1$"</span>, fontsize=<span style="color: #B452CD">18</span>)
|
||||
plt.title(<span style="color: #CD5555">"min_samples_leaf={}"</span>.format(tree_reg2.min_samples_leaf), fontsize=<span style="color: #B452CD">14</span>)
|
||||
|
||||
save_fig(<span style="color: #CD5555">"tree_regression_regularization_plot"</span>)
|
||||
plt.show()
|
||||
</pre></div>
|
||||
<p>
|
||||
|
||||
@@ -698,22 +698,6 @@ plt<span style="color: #666666">.</span>show()
|
||||
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
|
||||
|
||||
<h2 id="___sec14">Playing around with regions </h2>
|
||||
|
||||
<p>
|
||||
|
||||
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
|
||||
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span></span>angle <span style="color: #666666">=</span> np<span style="color: #666666">.</span>pi <span style="color: #666666">/</span> <span style="color: #666666">180</span> <span style="color: #666666">*</span> <span style="color: #666666">20</span>
|
||||
rotation_matrix <span style="color: #666666">=</span> np<span style="color: #666666">.</span>array([[np<span style="color: #666666">.</span>cos(angle), <span style="color: #666666">-</span>np<span style="color: #666666">.</span>sin(angle)], [np<span style="color: #666666">.</span>sin(angle), np<span style="color: #666666">.</span>cos(angle)]])
|
||||
Xr <span style="color: #666666">=</span> X<span style="color: #666666">.</span>dot(rotation_matrix)
|
||||
|
||||
tree_clf_r <span style="color: #666666">=</span> DecisionTreeClassifier(random_state<span style="color: #666666">=42</span>)
|
||||
tree_clf_r<span style="color: #666666">.</span>fit(Xr, y)
|
||||
|
||||
plt<span style="color: #666666">.</span>figure(figsize<span style="color: #666666">=</span>(<span style="color: #666666">8</span>, <span style="color: #666666">3</span>))
|
||||
plot_decision_boundary(tree_clf_r, Xr, y, axes<span style="color: #666666">=</span>[<span style="color: #666666">0.5</span>, <span style="color: #666666">7.5</span>, <span style="color: #666666">-1.0</span>, <span style="color: #666666">1</span>], iris<span style="color: #666666">=</span><span style="color: #008000">False</span>)
|
||||
|
||||
plt<span style="color: #666666">.</span>show()
|
||||
</pre></div>
|
||||
<p>
|
||||
|
||||
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
|
||||
@@ -836,7 +820,6 @@ plt<span style="color: #666666">.</span>axis([<span style="color: #666666">0</sp
|
||||
plt<span style="color: #666666">.</span>xlabel(<span style="color: #BA2121">"$x_1$"</span>, fontsize<span style="color: #666666">=18</span>)
|
||||
plt<span style="color: #666666">.</span>title(<span style="color: #BA2121">"min_samples_leaf={}"</span><span style="color: #666666">.</span>format(tree_reg2<span style="color: #666666">.</span>min_samples_leaf), fontsize<span style="color: #666666">=14</span>)
|
||||
|
||||
save_fig(<span style="color: #BA2121">"tree_regression_regularization_plot"</span>)
|
||||
plt<span style="color: #666666">.</span>show()
|
||||
</pre></div>
|
||||
<p>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -509,22 +509,6 @@ plt.show()
|
||||
|
||||
!split
|
||||
===== Playing around with regions =====
|
||||
|
||||
!bc pycod
|
||||
angle = np.pi / 180 * 20
|
||||
rotation_matrix = np.array([[np.cos(angle), -np.sin(angle)], [np.sin(angle), np.cos(angle)]])
|
||||
Xr = X.dot(rotation_matrix)
|
||||
|
||||
tree_clf_r = DecisionTreeClassifier(random_state=42)
|
||||
tree_clf_r.fit(Xr, y)
|
||||
|
||||
plt.figure(figsize=(8, 3))
|
||||
plot_decision_boundary(tree_clf_r, Xr, y, axes=[0.5, 7.5, -1.0, 1], iris=False)
|
||||
|
||||
plt.show()
|
||||
!ec
|
||||
|
||||
|
||||
!bc pycod
|
||||
np.random.seed(6)
|
||||
Xs = np.random.rand(100, 2) - 0.5
|
||||
@@ -637,7 +621,6 @@ plt.axis([0, 1, -0.2, 1.1])
|
||||
plt.xlabel("$x_1$", fontsize=18)
|
||||
plt.title("min_samples_leaf={}".format(tree_reg2.min_samples_leaf), fontsize=14)
|
||||
|
||||
save_fig("tree_regression_regularization_plot")
|
||||
plt.show()
|
||||
!ec
|
||||
|
||||
|
||||
Reference in New Issue
Block a user