I'm implementing prediction code for courses of computing fields using Naive Bayes classifier. The output is to predict whether the course is (management, design, database, analysis,…9 classes). I have only about 100 records of courses descriptions. I label 50 by search keyword and I will use them as 80% of them as train data and the 20% as test data where the other 50 courses to predict by the classifier. The classes are not balanced I can’t to change anything in data.

The accuracy is 75% how can I increase the accuracy?

Is it small for training dataset?

  • $\begingroup$ Try to create balanced training set - take almost same number of records for each class. Or, try giving weights to records. $\endgroup$
    – Ankit Seth
    Feb 11, 2018 at 7:23

1 Answer 1


Is there any reason you have to use Naive Bayes? While Naive Bayes does handle multi-class modeling quite nicely, sometimes the "naive" assumption that each word in the text is independent of the others is too naive, especially given the size of your training set. While you may be able to increase the accuracy a little bit by doing more text processing, I wouldn't expect to see significant improvement, especially given the training size.

Since Naive Bayes itself doesn't have much parameter tweaking, if you want to try more processing of the data itself to improve performance, you can try things like text count vectorization or TF-IDF vectorization to represent the text data more holistically than just keyword flagging.

If you are able to implement other models, I would take a look at the scikit learn multi-class models for ideas. Tree based methods are also inherently multiclass, and have more parameters to tweak, so implementing something like Random Forests may suit you better.

As for the training size itself, that does seem a little small. Especially if you are using text data, the more features you include, the more data you need to be able to stand a chance of detecting a signal in the data.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.