0
votes

I have a dataset of 2 numerical descriptive features and 3 categorical descriptive features. I have encoded the categorical features and scaling the nuemrical features. Now I want to use a Hybrid Naive Bayes classifier contains Bernoulli NB for categorical features and Gaussian NB for numerical features. I have tried to use Ensemble method of StackingClassifier in sklearn moduel, however, it does not have parameters that can clarify which Naive Bayes method for which part of the dataset. Is there any method that I am able to combine the two methods together and then fit the data?

1

1 Answers

0
votes

I believe you can create 2 groups of features.

use classifier 1: X[feature_group_1] -> Y[labels] as one classifier and classifier 2: X[feature_group_2] -> Y[labels] as other classifier.

For prediction also, you will have to divide test features in two groups: Xtest[feature_group_1] -> ytest1 Xtest[feature_group_2] -> ytest2

Then stack their outputs to get your final answer. For stacking you can use the VotingClassifier method.

from sklearn.ensemble import VotingClassifier

eclf2 = VotingClassifier(estimators=[
    ...         ('bnb', clf1), ('gnb', clf2)],
    ...         voting='soft')