Skip to content

Instantly share code, notes, and snippets.

from sklearn.datasets import fetch_20newsgroups
from sklearn.feature_extraction.text import TfidfTransformer,CountVectorizer
from sklearn.naive_bayes import MultinomialNB
categories= {'comp.graphics':'Graphics','rec.autos':'Auto',
'rec.motorcycles':'MotorCycle','rec.sport.baseball':'Baseball'
,'rec.sport.hockey':'Hockey',
'sci.space':'Space',
'talk.religion.misc': 'Religion'}