9

我知道可以像PMMLwith一样导出模型Spark-MLlib,但是呢Spark-ML

是否可以将LinearRegressionModelfrom转换org.apache.spark.ml.regressionLinearRegressionModelfromorg.apache.spark.mllib.regression以便能够调用该toPMML()方法?

4

1 回答 1

10

您可以使用JPMML-SparkML库将 Spark ML 管道转换为 PMML :

StructType schema = dataFrame.schema()
PipelineModel pipelineModel = pipeline.fit(dataFrame);
org.dmg.pmml.PMML pmml = org.jpmml.sparkml.ConverterUtil.toPMML(schema, pipelineModel);
JAXBUtil.marshalPMML(pmml, new StreamResult(System.out));
于 2016-05-05T09:28:43.493 回答