Github user yanboliang commented on a diff in the pull request:

    https://github.com/apache/spark/pull/13461#discussion_r65666918
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/util/ReadWrite.scala ---
    @@ -139,12 +144,27 @@ trait MLWritable {
       def save(path: String): Unit = write.save(path)
     }
     
    -private[ml] trait DefaultParamsWritable extends MLWritable { self: Params 
=>
    +/**
    + * :: Experimental ::
    + *
    + * Helper trait for making simple [[Params]] types writable.  If a 
[[Params]] class stores
    + * all data as [[org.apache.spark.ml.param.Param]] values, then extending 
this trait will provide
    + * a default implementation of writing saved instances of the class.
    + * This only handles simple [[org.apache.spark.ml.param.Param]] types; 
e.g., it will not handle
    + * [[org.apache.spark.sql.Dataset]] or 
[[org.apache.spark.ml.linalg.Vector]].
    --- End diff --
    
    I think we can support ```Param``` with type of ```Vector```. See the code 
of ```Param.jsonEncode```:
    ```
    /** Encodes a param value into JSON, which can be decoded by 
[[jsonDecode()]]. */
      def jsonEncode(value: T): String = {
        value match {
          case x: String =>
            compact(render(JString(x)))
          case v: Vector =>
            JsonVectorConverter.toJson(v)
          case _ =>
            throw new NotImplementedError(
              "The default jsonEncode only supports string and vector. " +
                s"${this.getClass.getName} must override jsonEncode for 
${value.getClass.getName}.")
        }
      }
    ```


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to