Reference no: EM133423577
Question 1: Explain the idea of bag-of-words model.
What are the two methods to treat the meaningless frequently occurring words?
Classify the documents in fetch_20newsgroups.
from sklearn.datasets import fetch_20newsgroups
from sklearn.model_selection import train_test_split
categories = ['alt.atheism', 'soc.religion.christian', 'comp.graphics', 'sci.med'] news = fetch_20newsgroups(categories=categories, shuffle=True, random_state=1)
X_train, X_test, y_train, y_test = train_test_split(news.data, news.target, test_size = 0.5, random_state=1)