Skip to content

Commit

Permalink
ml.IsotonicRegressionModel.copy should set parent
Browse files Browse the repository at this point in the history
  • Loading branch information
yanboliang committed Sep 7, 2015
1 parent 871764c commit 20717d8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ class IsotonicRegressionModel private[ml] (
def predictions: Vector = Vectors.dense(oldModel.predictions)

override def copy(extra: ParamMap): IsotonicRegressionModel = {
copyValues(new IsotonicRegressionModel(uid, oldModel), extra)
copyValues(new IsotonicRegressionModel(uid, oldModel), extra).setParent(parent)
}

override def transform(dataset: DataFrame): DataFrame = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package org.apache.spark.ml.regression

import org.apache.spark.SparkFunSuite
import org.apache.spark.ml.param.ParamsSuite
import org.apache.spark.ml.util.MLTestingUtils
import org.apache.spark.mllib.linalg.Vectors
import org.apache.spark.mllib.util.MLlibTestSparkContext
import org.apache.spark.sql.{DataFrame, Row}
Expand Down Expand Up @@ -89,6 +90,10 @@ class IsotonicRegressionSuite extends SparkFunSuite with MLlibTestSparkContext {
assert(ir.getFeatureIndex === 0)

val model = ir.fit(dataset)

// copied model must have the same parent.
MLTestingUtils.checkCopy(model)

model.transform(dataset)
.select("label", "features", "prediction", "weight")
.collect()
Expand Down

0 comments on commit 20717d8

Please sign in to comment.