sppam
raw JSON → 0.1.10 verified Sat May 09 auth: no python
A Python library for AUC maximization via a saddle point problem classifier. Current version: 0.1.10, early development stage with occasional releases.
pip install sppam Common errors
error ValueError: X has 10 features, but SPPAM is expecting 5 features as input. ↓
cause Inconsistent feature dimensions between fit and predict.
fix
Ensure the same preprocessing (e.g., feature selection) is applied to both training and test sets.
error ImportError: cannot import name 'SPPAM' from 'sppam' ↓
cause Incorrect import path or package not installed.
fix
Install sppam: pip install sppam. Use correct import: from sppam import SPPAM.
Warnings
gotcha The SPPAM classifier expects binary labels in {0,1} or {-1,1}. Using continuous or multi-class labels will lead to errors or incorrect results. ↓
fix Ensure target is binary and properly encoded: y = (y == 1).astype(int) or use LabelEncoder.
breaking Version 0.1.0 changed the default hyperparameters (lambda_reg, learning_rate) from previous alpha releases. Older code relying on defaults may behave differently. ↓
fix Explicitly set parameters if migrating from earlier versions. Check release notes for defaults.
gotcha The fit() method does not shuffle the data automatically. If data is ordered, performance may degrade. Manual shuffling is recommended. ↓
fix Shuffle data before calling fit: X, y = shuffle(X, y, random_state=0).
Imports
- SPPAM wrong
from sppam.sppam import SPPAMcorrectfrom sppam import SPPAM
Quickstart
from sppam import SPPAM
from sklearn.datasets import make_classification
from sklearn.model_selection import train_test_split
X, y = make_classification(n_samples=200, weights=[0.9, 0.1], random_state=42)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=42)
clf = SPPAM()
clf.fit(X_train, y_train)
score = clf.score(X_test, y_test)
print(f'AUC: {score:.3f}')