Run black on all the notebooks
- we use black's default settings - some cells are NOT kept in black's format to: - increase readability - or show Python's flexibility with regard to style
This commit is contained in:
parent
0ed024e020
commit
51a5dcc8ee
6 changed files with 45 additions and 67 deletions
|
|
@ -518,17 +518,17 @@
|
|||
],
|
||||
"source": [
|
||||
"feature_index = 2\n",
|
||||
"colors = ['blue', 'red', 'green']\n",
|
||||
"colors = [\"blue\", \"red\", \"green\"]\n",
|
||||
"\n",
|
||||
"for label, color in zip(range(len(iris.target_names)), colors):\n",
|
||||
" plt.hist(\n",
|
||||
" iris.data[iris.target==label, feature_index], \n",
|
||||
" iris.data[iris.target == label, feature_index],\n",
|
||||
" label=iris.target_names[label],\n",
|
||||
" color=color,\n",
|
||||
" )\n",
|
||||
"\n",
|
||||
"plt.xlabel(iris.feature_names[feature_index])\n",
|
||||
"plt.legend(loc='upper right')\n",
|
||||
"plt.legend(loc=\"upper right\")\n",
|
||||
"plt.show()"
|
||||
]
|
||||
},
|
||||
|
|
@ -559,19 +559,19 @@
|
|||
"first_feature_index = 1\n",
|
||||
"second_feature_index = 0\n",
|
||||
"\n",
|
||||
"colors = ['blue', 'red', 'green']\n",
|
||||
"colors = [\"blue\", \"red\", \"green\"]\n",
|
||||
"\n",
|
||||
"for label, color in zip(range(len(iris.target_names)), colors):\n",
|
||||
" plt.scatter(\n",
|
||||
" iris.data[iris.target==label, first_feature_index], \n",
|
||||
" iris.data[iris.target==label, second_feature_index],\n",
|
||||
" iris.data[iris.target == label, first_feature_index],\n",
|
||||
" iris.data[iris.target == label, second_feature_index],\n",
|
||||
" label=iris.target_names[label],\n",
|
||||
" c=color,\n",
|
||||
" )\n",
|
||||
"\n",
|
||||
"plt.xlabel(iris.feature_names[first_feature_index])\n",
|
||||
"plt.ylabel(iris.feature_names[second_feature_index])\n",
|
||||
"plt.legend(loc='upper left')\n",
|
||||
"plt.legend(loc=\"upper left\")\n",
|
||||
"plt.show()"
|
||||
]
|
||||
},
|
||||
|
|
@ -772,7 +772,9 @@
|
|||
}
|
||||
],
|
||||
"source": [
|
||||
"X_train, X_test, y_train, y_test = train_test_split(X, y, train_size=0.7, test_size=0.3, random_state=42, stratify=y)\n",
|
||||
"X_train, X_test, y_train, y_test = train_test_split(\n",
|
||||
" X, y, train_size=0.7, test_size=0.3, random_state=42, stratify=y\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"y_test"
|
||||
]
|
||||
|
|
@ -1040,12 +1042,12 @@
|
|||
" X_test[incorrect_idx, first_feature_index],\n",
|
||||
" X_test[incorrect_idx, second_feature_index],\n",
|
||||
" color=\"darkred\",\n",
|
||||
" label='misclassified',\n",
|
||||
" label=\"misclassified\",\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"plt.xlabel('sepal width [cm]')\n",
|
||||
"plt.ylabel('petal length [cm]')\n",
|
||||
"plt.legend(loc='best')\n",
|
||||
"plt.xlabel(\"sepal width [cm]\")\n",
|
||||
"plt.ylabel(\"petal length [cm]\")\n",
|
||||
"plt.legend(loc=\"best\")\n",
|
||||
"plt.title(\"Iris Classification results\")\n",
|
||||
"plt.show()"
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue