SVMLite
Work in Progress
This project is part of CS6375 Machine learning course at University of Texas at Dallas.
A lightweight Python library implementing Support Vector Machines from scratch for educational and experimental use.
Installation
pip install svmlite
Quick Start
from svmlite.svm import SVCLite
from svmlite.utils import StandardScalerLite
from svmlite.metrics import accuracy_score
import numpy as np
# prepare data
X = np.array([[1, 2], [2, 3], [3, 3], [6, 5], [7, 8], [8, 7]])
y = np.array([-1, -1, -1, 1, 1, 1])
# scale features
scaler = StandardScalerLite()
X_scaled = scaler.fit_transform(X)
# train SVM
model = SVCLite(C=1.0)
model.fit(X_scaled, y, learning_rate=0.01, n_iters=1000)
# predict
predictions = model.predict(X_scaled)
print("Predictions:", predictions)
# evaluate
acc = accuracy_score(y, predictions)
print("Accuracy:", acc)
Features
- Implemenation of primal form (hard margin and soft margin) of SVM Classification using Stochastic Gradient Descent (SGD).
- QP (Quadratic Programming) based SVM implementation using cvxopt
- Kernel Support: Linear, Polynomial, RBF kernel, Sigmoid kernel and Custom Kernel support
- SMO (Sequential Minimal Optimization) algorithm for optimization (simplified heuristic for selecting alpha pairs)
- Multiclass classification using One-vs-One (OvO) and One-vs-All (OvA) strategies
Modules Implemented from Scratch
- SVM Classifier
- Kernel Functions: Linear, Polynomial, RBF, Sigmoid
- Standard Scaler
- Metric functions: Accuracy
Release files for svmlite 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| svmlite-0.4.0.tar.gz | 17.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| svmlite-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size:31.2 kB
Release files / svmlite-0.4.0.tar.gz
| Download URL | svmlite-0.4.0.tar.gz |
|---|---|
| Size | 17.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ef130559cd4b18a4ab79b19ffe31f9513a016be32b03718c23ea0be9391fd2be
|
|
BLAKE2b-256 checksum How to use checksums |
2b18330341679be3c9f7b3ee4d47cc55abfc32dc5dee260b7853c22ae376dec8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Release files / svmlite-0.4.0-py3-none-any.whl
| Download URL | svmlite-0.4.0-py3-none-any.whl |
|---|---|
| Size | 13.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
206d64bbe866f93476a8b2668245b5db290b13bdef42e9337705ecca521edd9a
|
|
BLAKE2b-256 checksum How to use checksums |
ac0801909ecd2ef35bc4f71caef1b90ec69d029c5b7f7277f8da9da5974ecbc2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|