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

    https://github.com/apache/spark/pull/12230#discussion_r58926192
  
    --- Diff: 
mllib/src/main/scala/org/apache/spark/ml/classification/GBTClassifier.scala ---
    @@ -257,12 +240,61 @@ final class GBTClassificationModel private[ml](
       private[ml] def toOld: OldGBTModel = {
         new OldGBTModel(OldAlgo.Classification, _trees.map(_.toOld), 
_treeWeights)
       }
    +
    +  @Since("2.0.0")
    +  override def write: MLWriter = new 
GBTClassificationModel.GBTClassificationModelWriter(this)
     }
     
    -private[ml] object GBTClassificationModel {
    +@Since("2.0.0")
    +object GBTClassificationModel extends MLReadable[GBTClassificationModel] {
    +
    +  @Since("2.0.0")
    +  override def read: MLReader[GBTClassificationModel] = new 
GBTClassificationModelReader
    +
    +  @Since("2.0.0")
    +  override def load(path: String): GBTClassificationModel = 
super.load(path)
    +
    +  private[GBTClassificationModel]
    +  class GBTClassificationModelWriter(instance: GBTClassificationModel) 
extends MLWriter {
    +
    +    override protected def saveImpl(path: String): Unit = {
    +      val extraMetadata: JObject = Map(
    +        "numFeatures" -> instance.numFeatures,
    +        "numTrees" -> instance.getNumTrees)
    +      EnsembleModelReadWrite.saveImpl(instance, path, sqlContext, 
extraMetadata)
    +    }
    +  }
    +
    +  private class GBTClassificationModelReader extends 
MLReader[GBTClassificationModel] {
    +
    +    /** Checked against metadata when loading model */
    +    private val className = classOf[GBTClassificationModel].getName
    +    private val treeClassName = 
classOf[DecisionTreeRegressionModel].getName
    +
    +    override def load(path: String): GBTClassificationModel = {
    +      implicit val format = DefaultFormats
    +      val (metadata: Metadata, treesData: Array[(Metadata, Node)], 
treeWeights: Array[Double]) =
    +        EnsembleModelReadWrite.loadImpl(path, sqlContext, className, 
treeClassName)
    +      val numFeatures = (metadata.metadata \ "numFeatures").extract[Int]
    +      val numTrees = (metadata.metadata \ "numTrees").extract[Int]
    +
    +      val trees: Array[DecisionTreeRegressionModel] = treesData.map {
    --- End diff --
    
    I guess there is a slight m ix up here. This is the GBTClassifier. I see 
you have used DecisionTreeRegressionModel. Am I missing something?


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