How can I assign βcustomβ previous probabilities to Bayes rule in naive Bayes classifier in scikit?
For simplicity, take, for example, the Iris dataset, where we have 150 samples and 3 different classes with 50 samples per class. I assume that by default the previous probabilities p (c_i) = ~ 0.33 will be assigned based on the input data (and depending on how the training dataset was re-sampled).
But what if I get additional knowledge and know that color class 1 is much more common in "reality", so that the timers for different classes will be
p (c = 1) = 0.8
p (c = 2) = 0.1
p (c = 3) = 0.1
Suppose I have done all the pre-processing (skill selection, normalization / standardization, dimming, etc.) and would use the Naive Bayes (Gaussian) classifier as follows:
from sklearn.naive_bayes import GaussianNB gnb_clf = GaussianNB() gnb_clf.fit(X_train, y_train) pred_test = gnb_clf.predict(X_test)
How can I assign my "custom previous probabilities"?
I see that there is a set_params parameter for GaussianNB (see the documentation ), however I'm not sure how to use this ...
python scikit-learn bayesian
Sebastian
source share