Using PCA before Bayes classificition

2019-09-10 02:44发布

问题:

I'm trying using PCA before bayes classification ,but it says Native Bayes requires nonnegative features values, the training data used is nonnegative, but it turns to negative using PCA, how do I fix it ,Thanks to answer my question

回答1:

If you want to reduce the dimension of your inputs, you can use nonnegative matrix factorization instead. In Spark, this method is in mllib.recommendation.ALS and then set the nonnegative parameter as True.