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

    https://github.com/apache/spark/pull/9674#discussion_r44987039
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/Pipeline.scala ---
    @@ -200,4 +235,121 @@ class PipelineModel private[ml] (
       override def copy(extra: ParamMap): PipelineModel = {
         new PipelineModel(uid, stages.map(_.copy(extra))).setParent(parent)
       }
    +
    +  override def write: Writer = new PipelineModelWriter(this)
    +}
    +
    +object PipelineModel extends Readable[PipelineModel] {
    +
    +  override def read: Reader[PipelineModel] = new PipelineModelReader
    +
    +  override def load(path: String): PipelineModel = read.load(path)
    +}
    +
    +private[ml] class PipelineModelWriter(instance: PipelineModel) extends 
Writer {
    +
    +  
PipelineSharedWriter.validateStages(instance.stages.asInstanceOf[Array[PipelineStage]])
    +
    +  override protected def saveImpl(path: String): Unit = 
PipelineSharedWriter.saveImpl(instance,
    +    instance.stages.asInstanceOf[Array[PipelineStage]], sc, path)
    +}
    +
    +private[ml] class PipelineModelReader extends Reader[PipelineModel] {
    +
    +  /** Checked against metadata when loading model */
    +  private val className = "org.apache.spark.ml.PipelineModel"
    +
    +  override def load(path: String): PipelineModel = {
    +    val (uid: String, stages: Array[PipelineStage]) =
    +      PipelineSharedReader.load(className, sc, path)
    +    val transformers = stages map {
    +      case stage: Transformer => stage
    +      case stage => throw new RuntimeException(s"PipelineModel.read loaded 
a stage but found it" +
    --- End diff --
    
    minor: `stage` -> `other`


---
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.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to