How can the first probabilities for Naive Bayes clf be set in scikit-learn?

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 ...

+4
python scikit-learn bayesian
source share

No one has answered this question yet.

See similar questions:

8
How to indicate a preliminary probability for studying scikit Naive Bayes
0
Determining Prior Probabilities in Naive Bayes MultinomialNB

or similar:

8
How to indicate a preliminary probability for studying scikit Naive Bayes
4
How to predict your desired class using Naive Bayes in text classification
2
How to combine the results of several naive bike classifiers?
2
How to get the Importance function in naive bays?
one
How to evaluate accuracy on highly unbalanced data (using a naive Bayesian model)?
one
Bayes Network Classification
one
Hybrid Naive Bayes: How to train a Naive Bayes Classifer with a numerical and variable category together (sklearn)
one
multi-vector classification of Naive Bayes using scikit-learn
one
Scikit-learn Multiclass Naive Bayes with probabilities for y
0
TypeError: unsupported operand type for /: 'str' and 'long'

All Articles