Skip to content

Commit

Permalink
all warnings gone
Browse files Browse the repository at this point in the history
  • Loading branch information
MattBixley committed Nov 11, 2024
1 parent 5a80fec commit 4fd0340
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 6 deletions.
7 changes: 7 additions & 0 deletions notebooks/03.2-Regression-Forests.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,13 @@
"\n",
"Repeat this classification task with ``sklearn.ensemble.RandomForestClassifier``. How does the ``max_depth``, ``max_features``, and ``n_estimators`` affect the results?"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
9 changes: 8 additions & 1 deletion notebooks/04.1-Dimensionality-PCA.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
"outputs": [],
"source": [
"plt.scatter(Xproj[:, 0], Xproj[:, 1], c=y, edgecolor='none', alpha=0.5,\n",
" cmap=plt.cm.get_cmap('nipy_spectral', 10))\n",
" cmap=plt.colormaps.get_cmap('nipy_spectral'))\n",
"plt.colorbar();"
]
},
Expand Down Expand Up @@ -380,6 +380,13 @@
" \n",
"Each of these has its own strengths & weaknesses, and areas of application. You can read about them on the [scikit-learn website](http://sklearn.org)."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
10 changes: 5 additions & 5 deletions notebooks/04.2-Clustering-KMeans.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"outputs": [],
"source": [
"from sklearn.cluster import KMeans\n",
"est = KMeans(4) # 4 clusters\n",
"est = KMeans(4, n_init='auto') # 4 clusters\n",
"est.fit(X)\n",
"y_kmeans = est.predict(X)\n",
"plt.scatter(X[:, 0], X[:, 1], c=y_kmeans, s=50, cmap='rainbow');"
Expand Down Expand Up @@ -164,7 +164,7 @@
"metadata": {},
"outputs": [],
"source": [
"est = KMeans(n_clusters=10)\n",
"est = KMeans(n_clusters=10, n_init='auto')\n",
"clusters = est.fit_predict(digits.data)\n",
"est.cluster_centers_.shape"
]
Expand Down Expand Up @@ -208,7 +208,7 @@
"labels = np.zeros_like(clusters)\n",
"for i in range(10):\n",
" mask = (clusters == i)\n",
" labels[mask] = mode(digits.target[mask])[0]"
" labels[mask] = mode(digits.target[mask], keepdims=False)[0]"
]
},
{
Expand All @@ -228,7 +228,7 @@
"\n",
"X = PCA(2).fit_transform(digits.data)\n",
"\n",
"kwargs = dict(cmap = plt.cm.get_cmap('rainbow', 10),\n",
"kwargs = dict(cmap=plt.colormaps.get_cmap('rainbow'),\n",
" edgecolor='none', alpha=0.6)\n",
"fig, ax = plt.subplots(1, 2, figsize=(8, 4))\n",
"ax[0].scatter(X[:, 0], X[:, 1], c=labels, **kwargs)\n",
Expand Down Expand Up @@ -368,7 +368,7 @@
"\n",
"X = (china / 255.0).reshape(-1, 3)\n",
" \n",
"model = MiniBatchKMeans(n_colors)\n",
"model = MiniBatchKMeans(n_colors, n_init='auto')\n",
"labels = model.fit_predict(X)\n",
"colors = model.cluster_centers_\n",
"new_image = colors[labels].reshape(china.shape)\n",
Expand Down
7 changes: 7 additions & 0 deletions notebooks/05-Validation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -825,6 +825,13 @@
" \n",
"These tools are powerful means of evaluating your model on your data."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
8 changes: 8 additions & 0 deletions notebooks/06.1-Practice-Penguins.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,14 @@
"source": [
"# create a confusion matrix for cross-validated predictions\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3488c51c-4e0d-45ec-92aa-c791d14915d4",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down

0 comments on commit 4fd0340

Please sign in to comment.