This code base contains implementations and experiments related to Support Vector Machines (SVMs) as part of the course TMA4180 - Optimisation at the Norwegian University of Science and Technology (NTNU).
The authors of this project are:
- Henrik S. Grønlund
- Magnus U. Rønneseth
- Emilio Lombardo
- Theodoros Xenakis
Spring 2025.
This folder contains the code used for the numerical applications of Support Vector Machines (SVMs). There are three notebooks with the actual (graphical) implementations, and several python files with other helping code. The notebooks are:
-
kernelAnalysis.ipynb: This notebook contains the analysis of the kernels used in the report. It contains the code for the SVMs in
$\mathbb{R}^2$ and the analysis of the kernels used. - breastCancer.ipynb: This notebook contains the creation of SVM's for prediction on the breast cancer dataset.
- timeComplexity.ipynb: This notebook contains the analysis of time-complexity for varying size of the sample spaces.
The python file where the SVM algorithms are implemented lies in svmAlgorithms.py. dataset_gen.py contains data for generation of datasets, and kernel.py contains the kernels used in the project.
- Python 3.10+
- pip or pipenv
Clone the repository:
git clone https://github.com/your-username/your-repo.git
cd your-repoCreate a virtual environment:
python3.10 -m venv .venvActivate the virtual environment:
- Windows:
.venv\Scripts\activate
- macOS/Linux:
source .venv/bin/activate
Upgrade Pip:
python -m pip install --upgrade pipAdd Gitignore:
echo "*" > .venv/.gitignoreInstall the dependencies:
pip install -r requirements.txt