sigma_ - attribute of the instance that is computed during training. You are probably not going to modify it directly.
from sklearn.naive_bayes import GaussianNB import numpy as np X = np.array([[-1,-1],[-2,-1],[-3,-2],[1,1],[2,1],[3,2]]) y = np.array([1,1,1,2,2,2]) gnb = GaussianNB() print gnb.sigma_
Output:
AttributeError: 'GaussianNB' object has no attribute 'sigma_'
More code:
gnb.fit(X,y) ## training print gnb.sigma_
Output:
array([[ 0.66666667, 0.22222223], [ 0.66666667, 0.22222223]])
After training, you can change the value of sigma_ . This may affect forecasting results.
gnb.sigma_ = np.array([[1,1],[1,1]])
nobar
source share