Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions notebooks/clustering_ex_01.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"metadata": {},
"outputs": [],
"source": [
"%pip install seaborn\n",
"import seaborn as sns\n",
"\n",
"_ = sns.pairplot(data)"
Expand Down
1 change: 1 addition & 0 deletions notebooks/clustering_ex_02.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
"metadata": {},
"outputs": [],
"source": [
"%pip install seaborn\n",
"# Write your code here."
]
},
Expand Down
5 changes: 5 additions & 0 deletions notebooks/clustering_hdbscan.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,12 @@
"metadata": {},
"outputs": [],
"source": [
"%pip install pyodide-http\n",
"import pyodide_http\n",
"from sklearn.datasets import fetch_california_housing\n",
"\n",
"pyodide_http.patch_all()\n",
"\n",
"data, target = fetch_california_housing(return_X_y=True, as_frame=True)\n",
"target *= 100 # rescale the target in k$"
]
Expand All @@ -289,6 +293,7 @@
"metadata": {},
"outputs": [],
"source": [
"%pip install plotly nbformat\n",
"import plotly.express as px\n",
"\n",
"\n",
Expand Down
1 change: 1 addition & 0 deletions notebooks/clustering_kmeans.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
"metadata": {},
"outputs": [],
"source": [
"%pip install seaborn\n",
"import seaborn as sns\n",
"\n",
"_ = sns.pairplot(penguins, hue=\"Sex\", height=4)"
Expand Down
1 change: 1 addition & 0 deletions notebooks/clustering_sol_01.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"metadata": {},
"outputs": [],
"source": [
"%pip install seaborn\n",
"import seaborn as sns\n",
"\n",
"_ = sns.pairplot(data)"
Expand Down
1 change: 1 addition & 0 deletions notebooks/clustering_sol_02.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
"metadata": {},
"outputs": [],
"source": [
"%pip install seaborn\n",
"# solution\n",
"import matplotlib.pyplot as plt\n",
"import seaborn as sns\n",
Expand Down
1 change: 1 addition & 0 deletions notebooks/clustering_supervised_metrics.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
"metadata": {},
"outputs": [],
"source": [
"%pip install skrub\n",
"from skrub import StringEncoder\n",
"from sklearn.cluster import KMeans\n",
"from sklearn.pipeline import make_pipeline\n",
Expand Down
5 changes: 5 additions & 0 deletions notebooks/clustering_transformer.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@
"metadata": {},
"outputs": [],
"source": [
"%pip install pyodide-http\n",
"import pyodide_http\n",
"from sklearn.datasets import fetch_california_housing\n",
"\n",
"pyodide_http.patch_all()\n",
"\n",
"data, target = fetch_california_housing(return_X_y=True, as_frame=True)\n",
"target *= 100 # rescale the target in k$"
]
Expand Down Expand Up @@ -87,6 +91,7 @@
"metadata": {},
"outputs": [],
"source": [
"%pip install plotly nbformat\n",
"import plotly.express as px\n",
"\n",
"fig = px.scatter_map(\n",
Expand Down
1 change: 1 addition & 0 deletions python_scripts/clustering_ex_01.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
# We can explore the data using a seaborn `pairplot`.

# %%
# %pip install seaborn
import seaborn as sns

_ = sns.pairplot(data)
Expand Down
1 change: 1 addition & 0 deletions python_scripts/clustering_ex_02.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
# for the k-means cluster and the "true" labels).

# %%
# %pip install seaborn
# Write your code here.

# %% [markdown]
Expand Down
5 changes: 5 additions & 0 deletions python_scripts/clustering_hdbscan.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,12 @@ def make_wavy_blob(n_samples, shift=0.0, noise=0.2, freq=3):
# of the California Housing Dataset.

# %%
# %pip install pyodide-http
import pyodide_http
from sklearn.datasets import fetch_california_housing

pyodide_http.patch_all()

data, target = fetch_california_housing(return_X_y=True, as_frame=True)
target *= 100 # rescale the target in k$

Expand All @@ -205,6 +209,7 @@ def make_wavy_blob(n_samples, shift=0.0, noise=0.2, freq=3):
# California.

# %%
# %pip install plotly nbformat
import plotly.express as px


Expand Down
1 change: 1 addition & 0 deletions python_scripts/clustering_kmeans.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
# `pairplot`:

# %%
# %pip install seaborn
import seaborn as sns

_ = sns.pairplot(penguins, hue="Sex", height=4)
Expand Down
1 change: 1 addition & 0 deletions python_scripts/clustering_sol_01.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
# We can explore the data using a seaborn `pairplot`.

# %%
# %pip install seaborn
import seaborn as sns

_ = sns.pairplot(data)
Expand Down
1 change: 1 addition & 0 deletions python_scripts/clustering_sol_02.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
# for the k-means cluster and the "true" labels).

# %%
# %pip install seaborn
# solution
import matplotlib.pyplot as plt
import seaborn as sns
Expand Down
1 change: 1 addition & 0 deletions python_scripts/clustering_supervised_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
# This encoder is well suited to cluster text using `KMeans`.

# %%
# %pip install skrub
from skrub import StringEncoder
from sklearn.cluster import KMeans
from sklearn.pipeline import make_pipeline
Expand Down
5 changes: 5 additions & 0 deletions python_scripts/clustering_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@
# performance.

# %%
# %pip install pyodide-http
import pyodide_http
from sklearn.datasets import fetch_california_housing

pyodide_http.patch_all()

data, target = fetch_california_housing(return_X_y=True, as_frame=True)
target *= 100 # rescale the target in k$

Expand Down Expand Up @@ -63,6 +67,7 @@
# coast:

# %%
# %pip install plotly nbformat
import plotly.express as px

fig = px.scatter_map(
Expand Down