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

    https://github.com/apache/spark/pull/7952#discussion_r36355053
  
    --- Diff: 
mllib/src/main/scala/org/apache/spark/ml/regression/IsotonicRegression.scala ---
    @@ -67,52 +129,47 @@ private[regression] trait IsotonicRegressionParams 
extends PredictorParams {
      * Uses [[org.apache.spark.mllib.regression.IsotonicRegression]].
      */
     @Experimental
    -class IsotonicRegression(override val uid: String)
    -  extends Regressor[Double, IsotonicRegression, IsotonicRegressionModel]
    -  with IsotonicRegressionParams {
    +class IsotonicRegression(override val uid: String) extends 
Estimator[IsotonicRegressionModel]
    +  with IsotonicRegressionBase {
     
       def this() = this(Identifiable.randomUID("isoReg"))
     
    -  /**
    -   * Set the isotonic parameter.
    -   * Default is true.
    -   * @group setParam
    -   */
    -  def setIsotonicParam(value: Boolean): this.type = set(isotonic, value)
    -  setDefault(isotonic -> true)
    +  /** @group setParam */
    +  def setLabelCol(value: String): this.type = set(labelCol, value)
     
    -  /**
    -   * Set weight column param.
    -   * Default is weight.
    -   * @group setParam
    -   */
    -  def setWeightParam(value: String): this.type = set(weightCol, value)
    -  setDefault(weightCol -> "weight")
    +  /** @group setParam */
    +  def setFeaturesCol(value: String): this.type = set(featuresCol, value)
     
    -  override private[ml] def featuresDataType: DataType = DoubleType
    +  /** @group setParam */
    +  def setPredictionCol(value: String): this.type = set(predictionCol, 
value)
     
    -  override def copy(extra: ParamMap): IsotonicRegression = 
defaultCopy(extra)
    +  /** @group setParam */
    +  def setIsotonic(value: Boolean): this.type = set(isotonic, value)
     
    -  private[this] def extractWeightedLabeledPoints(
    -      dataset: DataFrame): RDD[(Double, Double, Double)] = {
    +  /** @group setParam */
    +  def setWeightCol(value: String): this.type = set(weightCol, value)
     
    -    dataset.select($(labelCol), $(featuresCol), $(weightCol))
    -      .map { case Row(label: Double, features: Double, weights: Double) =>
    -        (label, features, weights)
    -      }
    -  }
    +  /** @group setParam */
    +  def setFeatureIndex(value: Int): this.type = set(featureIndex, value)
    +
    +  override def copy(extra: ParamMap): IsotonicRegression = 
defaultCopy(extra)
     
    -  override protected def train(dataset: DataFrame): 
IsotonicRegressionModel = {
    -    SchemaUtils.checkColumnType(dataset.schema, $(weightCol), DoubleType)
    +  override def fit(dataset: DataFrame): IsotonicRegressionModel = {
    +    validateAndTransformSchema(dataset.schema, fitting = true)
         // Extract columns from data.  If dataset is persisted, do not persist 
oldDataset.
         val instances = extractWeightedLabeledPoints(dataset)
         val handlePersistence = dataset.rdd.getStorageLevel == 
StorageLevel.NONE
         if (handlePersistence) instances.persist(StorageLevel.MEMORY_AND_DISK)
     
         val isotonicRegression = new 
MLlibIsotonicRegression().setIsotonic($(isotonic))
    -    val parentModel = isotonicRegression.run(instances)
    +    val oldModel = isotonicRegression.run(instances)
    +
    +    new IsotonicRegressionModel(uid, oldModel)
    --- End diff --
    
    Call copyValues


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