Created
April 22, 2014 08:07
-
-
Save erogol/11169508 to your computer and use it in GitHub Desktop.
sklearn call
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
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