This folder contains Jupyter notebooks exploring unsupervised machine-learning techniques, including clustering, dimensionality reduction, and anomaly detection. The examples use scikit-learn's built-in Iris dataset, generated sample data, and an included thyroid dataset.
| Notebook or file | Topics |
|---|---|
k_means_clustering.ipynb |
K-means clustering and selecting the number of clusters |
k_means_iris.ipynb |
K-means applied to the Iris dataset |
hierarchical.ipynb |
Hierarchical clustering, dendrograms, and agglomerative clustering |
dbscan.ipynb |
Density-based clustering, including non-linear sample data |
PCA.ipynb |
Principal Component Analysis (PCA) for dimensionality reduction |
anomaly_detection.ipynb |
Anomaly detection with Isolation Forest and Local Outlier Factor |
thyroid_dataset.csv |
Local dataset used by the anomaly-detection notebook |
- Python 3.9 or later
- Jupyter Notebook or JupyterLab
From this folder, create and activate a virtual environment, then install the notebook dependencies:
python -m venv .venvOn Windows:
.\.venv\Scripts\Activate.ps1On macOS or Linux:
source .venv/bin/activateInstall the packages used by the notebooks and start Jupyter:
python -m pip install --upgrade pip
python -m pip install jupyter numpy pandas matplotlib seaborn scikit-learn scipy kneed
jupyter labOpen a notebook in Jupyter and run its cells from top to bottom. The anomaly-detection notebook reads thyroid_dataset.csv by a relative path, so launch Jupyter from this folder or update the path if you run it elsewhere. The other examples use scikit-learn's built-in datasets or generated data.
Start with K-means to learn centroid-based clustering, then compare it with hierarchical clustering and DBSCAN. Explore PCA as a dimensionality-reduction technique, and finish with the anomaly-detection examples.
- Notebooks are intended to be run independently; restart the kernel and run all cells if variables are missing.
.gitignoreexcludes generated Python and Jupyter files, local environments, and local editor settings. The CSV dataset is intentionally kept under version control.