You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -75,16 +106,26 @@ class NaiveBayesModel private[mllib] (
75
106
* document classification. By making every vector a 0-1 vector, it can also be used as
76
107
* Bernoulli NB ([[http://tinyurl.com/p7c96j6]]). The input feature values must be nonnegative.
@@ -141,7 +188,7 @@ class NaiveBayes private (private var lambda: Double) extends Serializable with
141
188
i +=1
142
189
}
143
190
144
-
newNaiveBayesModel(labels, pi, theta)
191
+
newNaiveBayesModel(labels, pi, theta, model)
145
192
}
146
193
}
147
194
@@ -154,8 +201,7 @@ object NaiveBayes {
154
201
*
155
202
* This is the Multinomial NB ([[http://tinyurl.com/lsdw6p]]) which can handle all kinds of
156
203
* discrete data. For example, by converting documents into TF-IDF vectors, it can be used for
157
-
* document classification. By making every vector a 0-1 vector, it can also be used as
158
-
* Bernoulli NB ([[http://tinyurl.com/p7c96j6]]).
204
+
* document classification.
159
205
*
160
206
* This version of the method uses a default smoothing parameter of 1.0.
161
207
*
@@ -171,8 +217,7 @@ object NaiveBayes {
171
217
*
172
218
* This is the Multinomial NB ([[http://tinyurl.com/lsdw6p]]) which can handle all kinds of
173
219
* discrete data. For example, by converting documents into TF-IDF vectors, it can be used for
174
-
* document classification. By making every vector a 0-1 vector, it can also be used as
175
-
* Bernoulli NB ([[http://tinyurl.com/p7c96j6]]).
220
+
* document classification.
176
221
*
177
222
* @paraminput RDD of `(label, array of features)` pairs. Every vector should be a frequency
* Trains a Naive Bayes model given an RDD of `(label, features)` pairs.
233
+
*
234
+
* This is by default the Multinomial NB ([[http://tinyurl.com/lsdw6p]]) which can handle
235
+
* all kinds of discrete data. For example, by converting documents into TF-IDF vectors,
236
+
* it can be used for document classification. By making every vector a 0-1 vector and
237
+
* setting the model type to NaiveBayesModels.Bernoulli, it fits and predicts as
238
+
* Bernoulli NB ([[http://tinyurl.com/p7c96j6]]).
239
+
*
240
+
* @paraminput RDD of `(label, array of features)` pairs. Every vector should be a frequency
241
+
* vector or a count vector.
242
+
* @paramlambda The smoothing parameter
243
+
*
244
+
* @parammodel The type of NB model to fit from the enumeration NaiveBayesModels, can be
0 commit comments