How to get feature Importance in naive bayes?

后端 未结 4 781
萌比男神i
萌比男神i 2020-12-28 18:41

I have a dataset of reviews which has a class label of positive/negative. I am applying Naive Bayes to that reviews dataset. Firstly, I am converting into Bag of words. Here

4条回答
  •  梦谈多话
    2020-12-28 19:01

    Try this:

    pred_proba = NB_optimal.predict_proba(X_test)
    words = np.take(count_vect.get_feature_names(), pred_proba.argmax(axis=1))
    

提交回复
热议问题