@@ -106,10 +106,10 @@ class GaussianNB(BaseNB):
106
106
107
107
Attributes
108
108
----------
109
- `class_prior_` : array, shape (n_classes)
109
+ `class_prior_` : array, shape (n_classes, )
110
110
probability of each class.
111
111
112
- `class_count_` : array, shape (n_classes)
112
+ `class_count_` : array, shape (n_classes, )
113
113
number of training samples observed in each class.
114
114
115
115
`theta_` : array, shape (n_classes, n_features)
@@ -141,11 +141,11 @@ def fit(self, X, y):
141
141
142
142
Parameters
143
143
----------
144
- X : array-like, shape = [ n_samples, n_features]
144
+ X : array-like, shape = ( n_samples, n_features)
145
145
Training vectors, where n_samples is the number of samples
146
146
and n_features is the number of features.
147
147
148
- y : array-like, shape = [ n_samples]
148
+ y : array-like, shape = ( n_samples,)
149
149
Target values.
150
150
151
151
Returns
@@ -193,21 +193,21 @@ def _update_mean_variance(n_past, mu, var, X):
193
193
194
194
Parameters
195
195
----------
196
- n_past : scalar
196
+ n_past : int
197
197
Number of samples represented in old mean and variance.
198
198
199
- mu: array-like, shape (number of Gaussians)
199
+ mu: array-like, shape (number of Gaussians, )
200
200
Means for Gaussians in original set.
201
201
202
- var: array-like, shape (number of Gaussians)
202
+ var: array-like, shape (number of Gaussians, )
203
203
Variances for Gaussians in original set.
204
204
205
205
Returns
206
206
-------
207
- mu_new: array-like, shape (number of Gaussians)
207
+ mu_new: array-like, shape (number of Gaussians, )
208
208
Updated mean for each Gaussian over the combined set.
209
209
210
- var_new: array-like, shape (number of Gaussians)
210
+ var_new: array-like, shape (number of Gaussians, )
211
211
Updated variance for each Gaussian over the combined set.
212
212
"""
213
213
if n_past == 0 :
@@ -249,10 +249,10 @@ def partial_fit(self, X, y, classes=None):
249
249
Training vectors, where n_samples is the number of samples and
250
250
n_features is the number of features.
251
251
252
- y : array-like, shape (n_samples)
252
+ y : array-like, shape (n_samples, )
253
253
Target values.
254
254
255
- classes : array-like, shape = (n_classes)
255
+ classes : array-like, shape (n_classes, )
256
256
List of all the classes that can possibly appear in the y vector.
257
257
258
258
Must be provided at the first call to partial_fit, can be omitted
@@ -295,7 +295,7 @@ def partial_fit(self, X, y, classes=None):
295
295
self .class_count_ [i ] += N_i
296
296
297
297
self .sigma_ [:, :] += epsilon
298
- self .class_prior_ = self .class_count_ / np .sum (self .class_count_ )
298
+ self .class_prior_ [:] = self .class_count_ / np .sum (self .class_count_ )
299
299
return self
300
300
301
301
def _joint_log_likelihood (self , X ):
0 commit comments