[ https://issues.apache.org/jira/browse/FLINK-1966?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14948456#comment-14948456 ]
ASF GitHub Bot commented on FLINK-1966: --------------------------------------- Github user chiwanpark commented on a diff in the pull request: https://github.com/apache/flink/pull/1186#discussion_r41498513 --- Diff: flink-staging/flink-ml/src/main/scala/org/apache/flink/ml/classification/SVM.scala --- @@ -228,6 +225,56 @@ class SVM extends Predictor[SVM] { parameters.add(OutputDecisionFunction, outputDecisionFunction) this } + + override def toPMML(): PMML = { + weightsOption match { + case None => { + throw new RuntimeException("The SVM model has not been trained. Call first fit" + + " before calling the export operation.") + } + case Some(weights) => { + val model = weights.collect().head + val pmml = new PMML() + pmml.setHeader(new Header().setDescription("Support Vector Machine")) + + // define the fields + val target = FieldName.create("prediction") + val fields = scala.Array.ofDim[FieldName](model.size) + Range(0, model.size).foreach(index => + fields(index) = FieldName.create("field_" + index) + ) --- End diff -- Need more scalaesque solution. > Add support for predictive model markup language (PMML) > ------------------------------------------------------- > > Key: FLINK-1966 > URL: https://issues.apache.org/jira/browse/FLINK-1966 > Project: Flink > Issue Type: Improvement > Components: Machine Learning Library > Reporter: Till Rohrmann > Assignee: Sachin Goel > Priority: Minor > Labels: ML > > The predictive model markup language (PMML) [1] is a widely used language to > describe predictive and descriptive models as well as pre- and > post-processing steps. That way it allows and easy way to export for and > import models from other ML tools. > Resources: > [1] > http://journal.r-project.org/archive/2009-1/RJournal_2009-1_Guazzelli+et+al.pdf -- This message was sent by Atlassian JIRA (v6.3.4#6332)