from sklearn.naive_bayes import MultinomialNB
nb = MultinomialNB(alpha = 10)
nb.fit(X_train_dtm, y_train)
It shows memory error while running this code.
So, a MemoryError
will occur when Python can't get a block of memory from the operating system. It seems unusual to be unable to allocate 29MB unless you're running this on a tiny computer.
One fix would be to use the partial_fit
method over chunks of the data.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.