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.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to