diff --git a/notebooks/clustering_ex_01.ipynb b/notebooks/clustering_ex_01.ipynb index 64a65e233..52b5473d1 100644 --- a/notebooks/clustering_ex_01.ipynb +++ b/notebooks/clustering_ex_01.ipynb @@ -45,6 +45,7 @@ "metadata": {}, "outputs": [], "source": [ + "%pip install seaborn\n", "import seaborn as sns\n", "\n", "_ = sns.pairplot(data)" diff --git a/notebooks/clustering_ex_02.ipynb b/notebooks/clustering_ex_02.ipynb index bf5b9b5e6..947584c27 100644 --- a/notebooks/clustering_ex_02.ipynb +++ b/notebooks/clustering_ex_02.ipynb @@ -83,6 +83,7 @@ "metadata": {}, "outputs": [], "source": [ + "%pip install seaborn\n", "# Write your code here." ] }, diff --git a/notebooks/clustering_hdbscan.ipynb b/notebooks/clustering_hdbscan.ipynb index 0411e09ba..bc7d5bbed 100644 --- a/notebooks/clustering_hdbscan.ipynb +++ b/notebooks/clustering_hdbscan.ipynb @@ -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$" ] @@ -289,6 +293,7 @@ "metadata": {}, "outputs": [], "source": [ + "%pip install plotly nbformat\n", "import plotly.express as px\n", "\n", "\n", diff --git a/notebooks/clustering_kmeans.ipynb b/notebooks/clustering_kmeans.ipynb index cfbb2bb39..463e8f87c 100644 --- a/notebooks/clustering_kmeans.ipynb +++ b/notebooks/clustering_kmeans.ipynb @@ -78,6 +78,7 @@ "metadata": {}, "outputs": [], "source": [ + "%pip install seaborn\n", "import seaborn as sns\n", "\n", "_ = sns.pairplot(penguins, hue=\"Sex\", height=4)" diff --git a/notebooks/clustering_sol_01.ipynb b/notebooks/clustering_sol_01.ipynb index af1b7034d..770941c56 100644 --- a/notebooks/clustering_sol_01.ipynb +++ b/notebooks/clustering_sol_01.ipynb @@ -45,6 +45,7 @@ "metadata": {}, "outputs": [], "source": [ + "%pip install seaborn\n", "import seaborn as sns\n", "\n", "_ = sns.pairplot(data)" diff --git a/notebooks/clustering_sol_02.ipynb b/notebooks/clustering_sol_02.ipynb index e906ee82d..855d9ac16 100644 --- a/notebooks/clustering_sol_02.ipynb +++ b/notebooks/clustering_sol_02.ipynb @@ -103,6 +103,7 @@ "metadata": {}, "outputs": [], "source": [ + "%pip install seaborn\n", "# solution\n", "import matplotlib.pyplot as plt\n", "import seaborn as sns\n", diff --git a/notebooks/clustering_supervised_metrics.ipynb b/notebooks/clustering_supervised_metrics.ipynb index b37381fbc..8a379dce3 100644 --- a/notebooks/clustering_supervised_metrics.ipynb +++ b/notebooks/clustering_supervised_metrics.ipynb @@ -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", diff --git a/notebooks/clustering_transformer.ipynb b/notebooks/clustering_transformer.ipynb index b442267a6..967729eaf 100644 --- a/notebooks/clustering_transformer.ipynb +++ b/notebooks/clustering_transformer.ipynb @@ -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$" ] @@ -87,6 +91,7 @@ "metadata": {}, "outputs": [], "source": [ + "%pip install plotly nbformat\n", "import plotly.express as px\n", "\n", "fig = px.scatter_map(\n", diff --git a/python_scripts/clustering_ex_01.py b/python_scripts/clustering_ex_01.py index 7b0ec1ef9..8108780bd 100644 --- a/python_scripts/clustering_ex_01.py +++ b/python_scripts/clustering_ex_01.py @@ -37,6 +37,7 @@ # We can explore the data using a seaborn `pairplot`. # %% +# %pip install seaborn import seaborn as sns _ = sns.pairplot(data) diff --git a/python_scripts/clustering_ex_02.py b/python_scripts/clustering_ex_02.py index ba27575ce..ea5119a2d 100644 --- a/python_scripts/clustering_ex_02.py +++ b/python_scripts/clustering_ex_02.py @@ -65,6 +65,7 @@ # for the k-means cluster and the "true" labels). # %% +# %pip install seaborn # Write your code here. # %% [markdown] diff --git a/python_scripts/clustering_hdbscan.py b/python_scripts/clustering_hdbscan.py index a477c394b..2b5b88006 100644 --- a/python_scripts/clustering_hdbscan.py +++ b/python_scripts/clustering_hdbscan.py @@ -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$ @@ -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 diff --git a/python_scripts/clustering_kmeans.py b/python_scripts/clustering_kmeans.py index 07e16fd9d..202471910 100644 --- a/python_scripts/clustering_kmeans.py +++ b/python_scripts/clustering_kmeans.py @@ -54,6 +54,7 @@ # `pairplot`: # %% +# %pip install seaborn import seaborn as sns _ = sns.pairplot(penguins, hue="Sex", height=4) diff --git a/python_scripts/clustering_sol_01.py b/python_scripts/clustering_sol_01.py index 80102254f..1ec30f6e3 100644 --- a/python_scripts/clustering_sol_01.py +++ b/python_scripts/clustering_sol_01.py @@ -31,6 +31,7 @@ # We can explore the data using a seaborn `pairplot`. # %% +# %pip install seaborn import seaborn as sns _ = sns.pairplot(data) diff --git a/python_scripts/clustering_sol_02.py b/python_scripts/clustering_sol_02.py index c2e7370b4..9972d824f 100644 --- a/python_scripts/clustering_sol_02.py +++ b/python_scripts/clustering_sol_02.py @@ -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 diff --git a/python_scripts/clustering_supervised_metrics.py b/python_scripts/clustering_supervised_metrics.py index de5e49911..3514b2ed3 100644 --- a/python_scripts/clustering_supervised_metrics.py +++ b/python_scripts/clustering_supervised_metrics.py @@ -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 diff --git a/python_scripts/clustering_transformer.py b/python_scripts/clustering_transformer.py index 7527aff6f..52ddc64a9 100644 --- a/python_scripts/clustering_transformer.py +++ b/python_scripts/clustering_transformer.py @@ -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$ @@ -63,6 +67,7 @@ # coast: # %% +# %pip install plotly nbformat import plotly.express as px fig = px.scatter_map(