关注 spark技术分享,
撸spark源码 玩spark最佳实践

Predictor

Predictor

Predictor is an Estimator for a PredictionModel with its own abstract train method.

The train method is supposed to ease dealing with schema validation and copying parameters to a trained PredictionModel model. It also sets the parent of the model to itself.

A Predictor is basically a function that maps a DataFrame onto a PredictionModel.

It implements the abstract fit(dataset: DataFrame) of the Estimator abstract class that validates and transforms the schema of a dataset (using a custom transformSchema of PipelineStage), and then calls the abstract train method.

Validation and transformation of a schema (using transformSchema) makes sure that:

  1. features column exists and is of correct type (defaults to Vector).

  2. label column exists and is of Double type.

As the last step, it adds the prediction column of Double type.

赞(0) 打赏
未经允许不得转载:spark技术分享 » Predictor
分享到: 更多 (0)

关注公众号:spark技术分享

联系我们联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏