Created
September 23, 2013 08:21
-
-
Save amueller/6667828 to your computer and use it in GitHub Desktop.
bcfw dual
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
#from sklearn.datasets import fetch_mldata | |
from sklearn.datasets import load_digits | |
from pystruct.models import MultiClassClf | |
from pystruct.learners import FrankWolfeSSVM, SubgradientSSVM, NSlackSSVM, OneSlackSSVM | |
from pystruct.utils import AnalysisLogger | |
from sklearn.utils import shuffle | |
digits = load_digits() | |
X_train, y_train = digits.data, digits.target | |
X_train = X_train / 16. | |
y_train = y_train.astype(np.int) | |
model = MultiClassClf() | |
bcfw = FrankWolfeSSVM(model=model, C=.1, max_iter=1000, tol=0.1, verbose=3, check_dual_every=10) | |
bcfw.fit(X_train, y_train) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment