Skip to content

Instantly share code, notes, and snippets.

@erogol
Created April 22, 2014 08:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erogol/11169508 to your computer and use it in GitHub Desktop.
Save erogol/11169508 to your computer and use it in GitHub Desktop.
sklearn call
if __name__ == '__main__':
from sklearn.cross_validation import StratifiedShuffleSplit
# svc = LinearSVC(class_weight='auto', penalty='l1', dual=False, verbose = 15, C=0.1)
svc = Perceptron(penalty='l1', alpha=0.05, fit_intercept=True, n_iter = 100, shuffle=True, n_jobs=-1, class_weight='auto', verbose=15)
sf = StratifiedShuffleSplit(y,n_iter = 2, train_size =0.9, test_size=0.1);
for train,test in sf:
X_train, X_test = X[train], X[test]
y_train, y_test = y[train], y[test]
print 'Train set size: ', X_train.shape
print 'Test set size: ', X_test.shape
svc.fit(X_train, y_train)
svc.score(X_test, y_test)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment