我知道可以像PMML
with一样导出模型Spark-MLlib
,但是呢Spark-ML
?
是否可以将LinearRegressionModel
from转换org.apache.spark.ml.regression
为LinearRegressionModel
fromorg.apache.spark.mllib.regression
以便能够调用该toPMML()
方法?
我知道可以像PMML
with一样导出模型Spark-MLlib
,但是呢Spark-ML
?
是否可以将LinearRegressionModel
from转换org.apache.spark.ml.regression
为LinearRegressionModel
fromorg.apache.spark.mllib.regression
以便能够调用该toPMML()
方法?
您可以使用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));