new NaiveBayes(lambda)
Trains a Naive Bayes model given an RDD of `(label, features)` pairs.
This is the Multinomial NB ([[http://tinyurl.com/lsdw6p]]) which can handle all kinds of
discrete data. For example, by converting documents into TF-IDF vectors, it can be used for
document classification. By making every vector a 0-1 vector, it can also be used as
Bernoulli NB ([[http://tinyurl.com/p7c96j6]]). The input feature values must be nonnegative.
Parameters:
Name |
Type |
Description |
lambda |
number
|
|
- Source:
Methods
Trains a Naive Bayes model given an RDD of `(label, features)` pairs.
The model type can be set to either Multinomial NB ([[http://tinyurl.com/lsdw6p]])
or Bernoulli NB ([[http://tinyurl.com/p7c96j6]]). The Multinomial NB can handle
discrete count data and can be called by setting the model type to "multinomial".
For example, it can be used with word counts or TF_IDF vectors of documents.
The Bernoulli model fits presence or absence (0-1) counts. By making every vector a
0-1 vector and setting the model type to "bernoulli", the fits and predicts as
Bernoulli NB.
Parameters:
Name |
Type |
Attributes |
Description |
input |
module:eclairjs.RDD
|
|
RDD of `(label, array of features)` pairs. Every vector should be a frequency
vector or a count vector. |
lambda |
float
|
<optional>
|
The smoothing parameter |
modelType |
string
|
<optional>
|
The type of NB model to fit from the enumeration NaiveBayesModels, can be
multinomial or bernoulli |
- Source:
Returns:
-
Type
-
module:eclairjs/mllib/classification.NaiveBayesModel
getLambda() → {float}
- Source:
Returns:
-
Type
-
float
getModelType() → {string}
- Source:
Returns:
-
Type
-
string
Run the algorithm with the configured parameters on an input RDD of LabeledPoint entries.
Parameters:
- Source:
Returns:
-
Type
-
module:eclairjs/mllib/classification.NaiveBayesModel
Parameters:
Name |
Type |
Description |
lambda |
float
|
|
- Source:
Returns:
-
Type
-
module:eclairjs/mllib/classification.NaiveBayes
Set the model type using a string (case-sensitive).
Supported options: "multinomial" (default) and "bernoulli".
Parameters:
Name |
Type |
Description |
modelType |
string
|
|
- Source:
Returns:
-
Type
-
module:eclairjs/mllib/classification.NaiveBayes