上QQ阅读APP看书,第一时间看更新
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.NaiveBayes
val nb = new NaiveBayes().setModelType("multinomial")
val model = nb.fit(Training_DataDF)