A collection of machine-learning methods implemented largely from the underlying math rather than off-the-shelf, spanning convolutional networks, one-class anomaly detection, autoencoders, and transformers. Built for a graduate statistical-computing course; each piece stands on its own.
| Method | File | Idea |
|---|---|---|
| Convolutional neural network | code/cnn_convolution.Rmd |
Convolution and a CNN for image-style classification |
| SVDD for directional data | code/svdd_directional_kernels.py |
Support Vector Data Description with four directional-data kernels (von Mises–Fisher, geodesic/Laplacian, heat/diffusion, Watson), solving the kernelized dual as a QP with CVXOPT |
| Least-squares SVDD | code/lssvdd_ionosphere.py |
LS-SVDD variant, demonstrated on the Ionosphere dataset |
| Autoencoder anomaly detection | code/autoencoder_outlier_detection.py |
PyTorch autoencoder flagging outliers by reconstruction error, on network firewall logs |
| Transformers | code/transformers.Rmd |
Attention / transformer mechanics |
The SVDD work is the most involved: it derives the kernel dual and implements four different kernels suited to data that lives on a sphere (directions/angles), rather than assuming ordinary Euclidean geometry.
Two public datasets are bundled in data/:
- Ionosphere (
ionosphere.data,ionosphere.names) — radar returns, Johns Hopkins University / UCI Machine Learning Repository. - Firewall log (
firewall_log.csv) — network traffic with allow/deny/drop actions, UCI Machine Learning Repository ("Internet Firewall Data").
The directional-SVDD script (svdd_directional_kernels.py) expects a data/twitter.csv of
geotagged coordinates. That file is not included (large and of uncertain redistribution
rights); the script documents the expected columns (longitude, latitude) so you can supply
your own directional data.
The Python scripts read their data via relative paths and are meant to be run from the code/
directory, e.g.:
cd code
python lssvdd_ionosphere.py
python autoencoder_outlier_detection.pyDependencies: numpy, pandas, scipy, scikit-learn, cvxopt (SVDD), torch (autoencoder).
The .Rmd files knit in R/RStudio.
.
├── README.md
├── code/ # one file per method
├── data/ # bundled public datasets
└── report/ # the written project report
Author: Katrina Stephenson