Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Machine Learning Fundamentals

Three coursework assignments covering core classical machine learning techniques: clustering, classification with dimensionality reduction, and regression. Each notebook follows the same structure — load data, explore, preprocess, train, evaluate, and interpret the result — applied to a different algorithm family and a different real-world dataset.


Contents

1. K-Means Clustering (hw1-kmeans-clustering/)

Customer segmentation on the Mall Customers dataset, comparing three clustering approaches on the same data:

Notebook Method
part1_kmeans.ipynb Standard K-Means, with both Elbow and Silhouette methods for choosing k
part2_kmeans_plusplus.ipynb K-Means with k-means++ centroid initialization
part3_bisecting_kmeans.ipynb Bisecting K-Means — a divisive, hierarchical variant

Each notebook compares StandardScaler (z-score) against MinMaxScaler normalization before clustering, and evaluates the resulting clusters with both the Elbow method (inertia) and Silhouette score.

2. SVM Classification & PCA (hw2-svm-pca/)

Multiclass human activity recognition — classifying accelerometer/gyroscope sensor readings into activity types (walking, sitting, standing, etc.), using the Human Activity Recognition dataset.

Notebook Focus
part1_svm.ipynb SVM classification with linear, RBF, and polynomial kernels, tuned via GridSearchCV
part2_pca.ipynb Dimensionality reduction with PCA before SVM — comparing accuracy and training time against the full-feature model

3. Regression (hw3-regression/)

Predicting insurance charges from demographic and health features, using the Medical Cost Personal Datasets (insurance) dataset.

Notebook Method
part1_polynomial_regression.ipynb Polynomial regression at degrees 1–5, analysing the bias-variance tradeoff
part2_svr.ipynb Support Vector Regression with linear, polynomial, and RBF kernels, compared against the best polynomial regression result

Datasets

All three datasets are small, well-known public benchmarks, included directly in this repository:

Dataset File(s) Source
Mall Customer Segmentation Mall_Customers.csv Common Kaggle benchmark dataset
Human Activity Recognition train.csv, test.csv UCI HAR Dataset
Medical Cost Personal Datasets insurance.csv Common Kaggle benchmark dataset

How to Run

pip install -r requirements.txt

Open any notebook in Jupyter Notebook, JupyterLab, VS Code, or Google Colab, and run all cells in order — each notebook is self-contained and loads its dataset from the same folder.

Note: these notebooks were originally written in Google Colab and use display() for formatted DataFrame previews. This works natively in Jupyter and Colab, but will raise a NameError if a cell is copied into a plain .py script run outside a notebook environment — replace display(df) with print(df) in that case.


Notes

  • HW1: the standard K-Means and K-Means++ notebooks both settle on k=5 as optimal; Bisecting K-Means's Elbow plot suggests k=6, illustrating how the choice of algorithm can shift the "optimal" cluster count even on identical data.
  • HW2: hyperparameter search (GridSearchCV) is deliberately scoped to a small grid (C, gamma) to keep runtime reasonable — SVM training on the full HAR feature set is computationally expensive across a wider search space.
  • HW3: the SVR notebook (part2_svr.ipynb) references the best polynomial regression result from part1_polynomial_regression.ipynb as a fixed comparison value, carried over manually between notebooks rather than computed at runtime — a reasonable simplification for a two-part assignment, but worth knowing if reproducing the comparison table independently.

License

MIT — see LICENSE.

This repository contains coursework completed for AIN3001 (Machine Learning) at Bahçeşehir University, published for reference and learning. If you are taking this or a similar course, do not submit any part of this work as your own.

About

Classical ML coursework: K-Means variants, SVM with PCA, polynomial regression and SVR

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages