Mixing categorial and continuous data in Naive Bayes classifier using scikit-learn

后端 未结 3 1361
逝去的感伤
逝去的感伤 2020-12-02 05:56

I\'m using scikit-learn in Python to develop a classification algorithm to predict the gender of certain customers. Amongst others, I want to use the Naive Bayes classifier

3条回答
  •  粉色の甜心
    2020-12-02 06:13

    The simple answer: multiply result!! it's the same.

    Naive Bayes based on applying Bayes’ theorem with the “naive” assumption of independence between every pair of features - meaning you calculate the Bayes probability dependent on a specific feature without holding the others - which means that the algorithm multiply each probability from one feature with the probability from the second feature (and we totally ignore the denominator - since it is just a normalizer).

    so the right answer is:

    1. calculate the probability from the categorical variables.
    2. calculate the probability from the continuous variables.
    3. multiply 1. and 2.

提交回复
热议问题