use of org.apache.spark.ml.feature.ResolvedRFormula in project jpmml-sparkml by jpmml.
the class RFormulaModelConverter method registerFeatures.
@Override
public void registerFeatures(SparkMLEncoder encoder) {
RFormulaModel transformer = getTransformer();
ResolvedRFormula resolvedFormula = transformer.resolvedFormula();
String targetCol = resolvedFormula.label();
String labelCol = transformer.getLabelCol();
if (!(targetCol).equals(labelCol)) {
List<Feature> features = encoder.getFeatures(targetCol);
encoder.putFeatures(labelCol, features);
}
PipelineModel pipelineModel = transformer.pipelineModel();
Transformer[] stages = pipelineModel.stages();
for (Transformer stage : stages) {
FeatureConverter<?> featureConverter = ConverterUtil.createFeatureConverter(stage);
featureConverter.registerFeatures(encoder);
}
}
Aggregations