mirror of
https://github.com/ArthurDanjou/handson-ml3.git
synced 2026-01-30 11:37:49 +01:00
Fix comment and simplify 'neighbors' code
This commit is contained in:
@@ -1854,7 +1854,7 @@
|
|||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"Let's focus on digits 3 and 5, which seem to overlap a lot."
|
"Let's focus on digits 2, 3 and 5, which seem to overlap a lot."
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -1951,7 +1951,7 @@
|
|||||||
" plt.axis(\"off\")\n",
|
" plt.axis(\"off\")\n",
|
||||||
" ax = plt.gcf().gca() # get current axes in current figure\n",
|
" ax = plt.gcf().gca() # get current axes in current figure\n",
|
||||||
" for index, image_coord in enumerate(X_normalized):\n",
|
" for index, image_coord in enumerate(X_normalized):\n",
|
||||||
" closest_distance = np.linalg.norm(np.array(neighbors) - image_coord, axis=1).min()\n",
|
" closest_distance = np.linalg.norm(neighbors - image_coord, axis=1).min()\n",
|
||||||
" if closest_distance > min_distance:\n",
|
" if closest_distance > min_distance:\n",
|
||||||
" neighbors = np.r_[neighbors, [image_coord]]\n",
|
" neighbors = np.r_[neighbors, [image_coord]]\n",
|
||||||
" if images is None:\n",
|
" if images is None:\n",
|
||||||
|
|||||||
Reference in New Issue
Block a user