The estimator algorithm

An estimator is another algorithm that can produce a transformer by fitting on a DataFrame. For instance, a learning algorithm can train on a dataset and produce a model. This produces a transformer by learning an algorithm. It uses the fit() method to produce a transformer. For instance, the Naïve Bayes learning algorithm is an estimator that calls the fit() method and trains a Naïve Bayes model, which is a transformer. We will use the following code to train the model:

import org.apache.spark.ml.classification.NaiveBayesval nb = new NaiveBayes().setModelType("multinomial")val model = nb.fit(Training_DataDF)

Get Artificial Intelligence for Big Data now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.