alotfata / Natural-Language-Processing-Project

1 stars 0 forks source link

Main #2

Open alotfata opened 2 years ago

alotfata commented 2 years ago

Creating the Bag of Words model from sklearn.feature_extraction.text import CountVectorizer cv = CountVectorizer(max_features = 1500) X = cv.fit_transform(corpus).toarray() y = dataset.iloc[:, -1].values Splitting the dataset into the Training set and Test set from sklearn.model_selection import train_test_split X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.20, random_state = 0) Training the Naive Bayes model on the Training set from sklearn.naive_bayes import GaussianNB classifier = GaussianNB() classifier.fit(X_train, y_train) After running the code- it shows error [bad input shape (250, 1500) ] Can you please explain the reason of the error?