Skip to content

Commit

Permalink
Fix comment.
Browse files Browse the repository at this point in the history
  • Loading branch information
stefmolin committed Mar 23, 2019
1 parent a23e8f7 commit 8e4f65e
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions ch_09/planets_ml.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@
{
"data": {
"text/plain": [
"<matplotlib.axes._subplots.AxesSubplot at 0x6119cb0>"
"<matplotlib.axes._subplots.AxesSubplot at 0x5548e10>"
]
},
"execution_count": 4,
Expand Down Expand Up @@ -272,7 +272,7 @@
{
"data": {
"text/plain": [
"<matplotlib.axes._subplots.AxesSubplot at 0x1abba470>"
"<matplotlib.axes._subplots.AxesSubplot at 0x1a668bd0>"
]
},
"execution_count": 5,
Expand Down Expand Up @@ -332,7 +332,7 @@
{
"data": {
"text/plain": [
"<matplotlib.legend.Legend at 0x1ac2a290>"
"<matplotlib.legend.Legend at 0x1b77d1d0>"
]
},
"execution_count": 7,
Expand Down Expand Up @@ -567,7 +567,7 @@
{
"data": {
"text/plain": [
"<matplotlib.axes._subplots.AxesSubplot at 0x1ac66570>"
"<matplotlib.axes._subplots.AxesSubplot at 0x1b7b7890>"
]
},
"execution_count": 11,
Expand Down Expand Up @@ -890,8 +890,12 @@
"inside = fig.add_axes([0.7, 0.2, 0.25, 0.25])\n",
"\n",
"# scaled data and cluster distance data\n",
"scaled = kmeans_pipeline_2.named_steps['scale'].fit_transform(kmeans_data).flatten()\n",
"cluster_distances = kmeans_pipeline_2.fit_transform(kmeans_data).flatten()\n",
"scaled = kmeans_pipeline_2.named_steps['scale'].fit_transform(\n",
" kmeans_data\n",
").flatten()\n",
"cluster_distances = kmeans_pipeline_2.fit_transform(\n",
" kmeans_data\n",
").flatten()\n",
"\n",
"for ax, data, title, axes_labels in zip(\n",
" [outside, inside], [scaled, cluster_distances], \n",
Expand All @@ -909,8 +913,9 @@
" ax.set_ylabel(f'period ({axes_labels})')\n",
" ax.set_ylim(-1, None)\n",
" \n",
"# add the centroids to the first subplot\n",
"cluster_centers = kmeans_pipeline_2.named_steps['kmeans'].cluster_centers_\n",
"# add the centroids to the outside plot\n",
"cluster_centers = kmeans_pipeline_2.named_steps['kmeans']\\\n",
" .cluster_centers_\n",
"for color, centroid in zip(['green', 'purple'], cluster_centers):\n",
" outside.annotate(\n",
" f'{color} center', xy=centroid, xytext=centroid + [0, 5], \n",
Expand Down

0 comments on commit 8e4f65e

Please sign in to comment.