Skip to content

Instantly share code, notes, and snippets.

@vijayanandrp
Created October 31, 2017 03:19
Show Gist options
  • Save vijayanandrp/e2b1662678fd77b55f6777c8a28862da to your computer and use it in GitHub Desktop.
Save vijayanandrp/e2b1662678fd77b55f6777c8a28862da to your computer and use it in GitHub Desktop.
Topic Classification by Linear classifiers (SVM, logistic regression, a.o.) with SGD training. Simple examp
Accuracy of SGDClassifier (support vector machine - SVM) - 91.27829560585884
Accuracy (after tuning) of SGDClassifier (support vector machine - SVM) - 91.27829560585884
Grid Search best score -
0.965440850687
Grid Search best parameters -
{'clf__alpha': 0.001, 'tfidf__use_idf': True, 'vect__ngram_range': (1, 1)}
Metrics classification report
precision recall f1-score support
alt.atheism 0.95 0.81 0.87 319
comp.graphics 0.88 0.97 0.92 389
sci.med 0.94 0.90 0.92 396
soc.religion.christian 0.90 0.95 0.93 398
avg / total 0.92 0.91 0.91 1502
Metric Confusion matrix
[[258 11 15 35]
[ 4 379 3 3]
[ 5 33 355 3]
[ 5 10 4 379]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment