Naive Bayes methods are a set of supervised learning algorithms based on applying Bayes' theorem with the “naive” assumption of conditional independence between every pair of features given the value of the class variable.
Use the above dataframe as reference and build a Naive Bayes
Classifier using python. Follow the guidelines.
-
Build a production ready classifier following the API interfaces.
-
Class should be reusable using new dataframes.
-
fit
method should takedata
which is complete dataframeX
list of only feature names andy
target name not completend.array
. -
predict
method should acceptX
only one example as list or tuple and return predicted probability.class NB: def __init__(self): pass def fit(self, data, X, y): pass def predict(self, X): pass