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
10 changes: 6 additions & 4 deletions practical-k-means/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ Follow the instructions below to get up and running with a Jupyter notebook and
These notebooks have dependencies. One way to install these dependencies is to use the Anaconda Python distribution.

```bash
(base) $ conda install jupyter matplotlib numpy pandas seaborn scikit-learn
(base) $ conda install -c conda-forge kneed
(base) $ conda install -c conda-forge \
jupyter "matplotlib=3.11" "numpy=2.5" "pandas=3.1" \
"seaborn=0.13" "scikit-learn=1.9"
(base) $ conda install -c conda-forge "kneed=0.9"
```

You can also install all the requirements using `pip` and the `requirements.txt` file included in this directory.
Expand All @@ -26,13 +28,13 @@ $ python3 -m pip install -r requirements.txt
Open the notebook that accompanies the sections of the article that work with synthetic data:

```bash
(base) $ jupyter notebook practical-kmeans-synthetic.ipynb
(base) $ jupyter notebook practical-k-means-syntethic.ipynb
```

### Cancer Gene Expression Data Notebook

Open the notebook that accompanies the sections of the article that work with TCGA cancer gene expression data:

```bash
(base) $ jupyter notebook practical-kmeans-cancer-gene-expression.ipynb
(base) $ jupyter notebook practical-k-means-cancer-gene-expression.ipynb
```
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,8 @@
"plt.figure(figsize=(8, 8))\n",
"\n",
"scat = sns.scatterplot(\n",
" \"component_1\",\n",
" \"component_2\",\n",
" x=\"component_1\",\n",
" y=\"component_2\",\n",
" s=50,\n",
" data=pcadf,\n",
" hue=\"predicted_cluster\",\n",
Expand Down
4 changes: 2 additions & 2 deletions practical-k-means/practical-k-means-syntethic.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -407,8 +407,8 @@
"dbscan.fit(scaled_features)\n",
"\n",
"# Compute the silhouette scores for each algorithm\n",
"kmeans_silhouette = silhouette_score(scaled_features, kmeans.labels_).round(2)\n",
"dbscan_silhouette = silhouette_score(scaled_features, dbscan.labels_).round(2)"
"kmeans_silhouette = round(silhouette_score(scaled_features, kmeans.labels_), 2)\n",
"dbscan_silhouette = round(silhouette_score(scaled_features, dbscan.labels_), 2)"
]
},
{
Expand Down
14 changes: 7 additions & 7 deletions practical-k-means/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
jupyter
kneed
matplotlib
numpy
pandas
seaborn
scikit-learn
jupyter==1.1.1
kneed==0.9.0
matplotlib==3.11.2
numpy==2.5.5
pandas==3.1.1
scikit-learn==1.9.1
seaborn==0.13.2
Loading