scikit-learn/scikit-learn — pull request #1888 by kemaleren (2013-04-23 19:04:29+00:00)
Title: Precompute norms to speed up SGD

Fixes #1327.

Not sure why, but performance is worse for small datasets. Using the following benchmark code:

from sklearn.linear_model import PassiveAggressiveClassifier
from sklearn.datasets import make_classification

learner = PassiveAggressiveClassifier(n_iter=50, random_state=0)
x, y = make_classification(n_samples=100, n_features=20, random_state=0)
learner.fit(x, y)

speedup was 0.85 (before: 1.75 ms, now: 2.06 ms).

However, with `n_iter=500, n_samples=10000, n_features=2000`, the speedup was 1.36 (before: 34.4 s, now: 25.3 s).