changed CountVectorizer => my BOW

This commit is contained in:
Anne Lorenz 2018-09-14 09:49:56 +02:00
parent a6df94131c
commit c2066d6adb
1 changed files with 10 additions and 10 deletions

View File

@ -53,18 +53,18 @@ class NaiveBayes:
n += 1
print('# split no. ' + str(n))
# # eigenes BOW => schlechtere ergebnisse
# vocab = BagOfWords.make_vocab(X[train])
# # fit the training data and then return the matrix
# training_data = BagOfWords.make_matrix(X[train], vocab)
# # transform testing data and return the matrix
# testing_data = BagOfWords.make_matrix(X[test], vocab)
# # using CountVectorizer:
# eigenes BOW => schlechtere ergebnisse
vocab = BagOfWords.make_vocab(X[train])
# fit the training data and then return the matrix
training_data = cv.fit_transform(X[train], y[train]).toarray()
training_data = BagOfWords.make_matrix(X[train], vocab)
# transform testing data and return the matrix
testing_data = cv.transform(X[test]).toarray()
testing_data = BagOfWords.make_matrix(X[test], vocab)
# # # using CountVectorizer:
# # fit the training data and then return the matrix
# training_data = cv.fit_transform(X[train], y[train]).toarray()
# # transform testing data and return the matrix
# testing_data = cv.transform(X[test]).toarray()
# # apply select percentile
# selector = SelectPercentile(percentile=25)