Class: NaiveBayes

eclairjs/ml/classification.NaiveBayes

Naive Bayes Classifiers. It supports both Multinomial NB http://nlp.stanford.edu/IR-book/html/htmledition/naive-bayes-text-classification-1.html which can handle finitely supported discrete data. For example, by converting documents into TF-IDF vectors, it can be used for document classification. By making every vector a binary (0/1) data, it can also be used as Bernoulli NB http://nlp.stanford.edu/IR-book/html/htmledition/the-bernoulli-model-1.html. The input feature values must be nonnegative.

Constructor

new NaiveBayes(uidopt)

Parameters:
Name Type Attributes Description
uid string <optional>
Source:

Extends

Methods

(static) load(path) → {NaiveBayes}

Parameters:
Name Type Description
path string
Source:
Returns:
Type
NaiveBayes

copy(extra) → {module:eclairjs/mllib/classification.NaiveBayes}

Parameters:
Name Type Description
extra module:eclairjs/ml/param.ParamMap
Overrides:
Source:
Returns:
Type
module:eclairjs/mllib/classification.NaiveBayes

extractParamMap() → {module:eclairjs/ml/param.ParamMap}

Inherited From:
Source:
Returns:
Type
module:eclairjs/ml/param.ParamMap

featuresCol() → {module:eclairjs/ml/param.Param}

Param for features column name.
Source:
Returns:
Type
module:eclairjs/ml/param.Param

fit(dataset, paramMapopt) → {module:eclairjs/ml/classification.LogisticRegressionModel}

Fits a model to the input data.
Parameters:
Name Type Attributes Description
dataset module:eclairjs/sql.DataFrame
paramMap module:eclairjs/ml/param.ParamMap <optional>
Parameter map. These values override any specified in this Estimator's embedded ParamMap.
Overrides:
Source:
Returns:
fitted model
Type
module:eclairjs/ml/classification.LogisticRegressionModel

getFeaturesCol() → {Promise.<string>}

Source:
Returns:
Type
Promise.<string>

getLabelCol() → {Promise.<string>}

Source:
Returns:
Type
Promise.<string>

getModelType() → {Promise.<string>}

Source:
Returns:
Type
Promise.<string>

getPredictionCol() → {Promise.<string>}

Source:
Returns:
Type
Promise.<string>

getSmoothing() → {Promise.<Number>}

Source:
Returns:
Type
Promise.<Number>

labelCol() → {module:eclairjs/ml/param.Param}

Param for label column name.
Source:
Returns:
Type
module:eclairjs/ml/param.Param

modelType() → {module:eclairjs/ml/param.Param}

The model type which is a string (case-sensitive). Supported options: "multinomial" and "bernoulli". (default = multinomial)
Source:
Returns:
Type
module:eclairjs/ml/param.Param

predictionCol() → {module:eclairjs/ml/param.Param}

Param for prediction column name.
Source:
Returns:
Type
module:eclairjs/ml/param.Param

probabilityCol() → {module:eclairjs/ml/param.Param}

Inherited From:
Source:
Returns:
Type
module:eclairjs/ml/param.Param

setFeaturesCol(value) → {module:eclairjs/ml.Predictor}

Parameters:
Name Type Description
value string
Inherited From:
Source:
Returns:
Type
module:eclairjs/ml.Predictor

setLabelCol(value) → {module:eclairjs/ml.Predictor}

Parameters:
Name Type Description
value string
Inherited From:
Source:
Returns:
Type
module:eclairjs/ml.Predictor

setModelType(value) → {module:eclairjs/mllib/classification.NaiveBayes}

Set the model type using a string (case-sensitive). Supported options: "multinomial" and "bernoulli". Default is "multinomial"
Parameters:
Name Type Description
value string
Source:
Returns:
Type
module:eclairjs/mllib/classification.NaiveBayes

setPredictionCol(value) → {module:eclairjs/ml.Predictor}

Parameters:
Name Type Description
value string
Inherited From:
Source:
Returns:
Type
module:eclairjs/ml.Predictor

setProbabilityCol(value) → {object}

Parameters:
Name Type Description
value string
Inherited From:
Source:
Returns:
Type
object

setRawPredictionCol(value) → {module:eclairjs/ml/classification.Classifier}

Parameters:
Name Type Description
value string
Inherited From:
Source:
Returns:
Type
module:eclairjs/ml/classification.Classifier

setSmoothing(value) → {module:eclairjs/mllib/classification.NaiveBayes}

Set the smoothing parameter. Default is 1.0.
Parameters:
Name Type Description
value number
Source:
Returns:
Type
module:eclairjs/mllib/classification.NaiveBayes

setThresholds(value) → {object}

Parameters:
Name Type Description
value Array.<float>
Inherited From:
Source:
Returns:
Type
object

smoothing() → {module:eclairjs/ml/param.DoubleParam}

The smoothing parameter. (default = 1.0).
Source:
Returns:
Type
module:eclairjs/ml/param.DoubleParam

thresholds() → {module:eclairjs/ml/param.Param}

Inherited From:
Source:
Returns:
Type
module:eclairjs/ml/param.Param

transformSchema(schema) → {module:eclairjs/sql/types.StructType}

Parameters:
Name Type Description
schema module:eclairjs/sql/types.StructType
Inherited From:
Source:
Returns:
Type
module:eclairjs/sql/types.StructType

validateAndTransformSchema(schema, fitting, featuresDataType) → {module:eclairjs/sql/types.StructType}

Validates and transforms the input schema with the provided param map.
Parameters:
Name Type Description
schema module:eclairjs/sql/types.StructType
fitting boolean whether this is in fitting
featuresDataType module:eclairjs/sql/types.DataType SQL DataType for FeaturesType. E.g., module:eclairjs/sql/types.VectorUDTfor vector features
Source:
Returns:
Type
module:eclairjs/sql/types.StructType

write() → {module:eclairjs/ml/util.MLWriter}

Source:
Returns:
Type
module:eclairjs/ml/util.MLWriter