Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-10479] [SPARK-10480] [ML] Fix ML.LinearRegressionModel.copy() #8641

Closed
wants to merge 2 commits into from

Conversation

yanboliang
Copy link
Contributor

This PR fix two model copy() related issues:
SPARK-10480
ML.LinearRegressionModel.copy() ignored argument extra, it will not take effect when users setting this parameter.
SPARK-10479
ML.LogisticRegressionModel.copy() should copy model summary if available.

@srowen
Copy link
Member

srowen commented Sep 7, 2015

Looks OK. On the borderline of needing a JIRA. really this is a fix for SPARK-8538 / SPARK-8539 I think. CC @feynmanliang

@SparkQA
Copy link

SparkQA commented Sep 7, 2015

Test build #42093 has finished for PR 8641 at commit 8e1d219.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@feynmanliang
Copy link
Contributor

LGTM, just noticed that LogisticRegression doesn't copy the summary object, SPARK-10479 will track that work

@yanboliang yanboliang changed the title [Minor] [ML] Fix ML.LinearRegressionModel.copy() [SPARK-10480] [ML] Fix ML.LinearRegressionModel.copy() Sep 8, 2015
@srowen
Copy link
Member

srowen commented Sep 8, 2015

@yanboliang how about fixing SPARK-10479 here too? it's very similar.

@yanboliang
Copy link
Contributor Author

@srowen OK, I have updated this PR to fix both SPARK-10479 and SPARK-10480

@@ -468,7 +468,9 @@ class LogisticRegressionModel private[ml] (
}

override def copy(extra: ParamMap): LogisticRegressionModel = {
copyValues(new LogisticRegressionModel(uid, weights, intercept), extra).setParent(parent)
val newModel = copyValues(new LogisticRegressionModel(uid, weights, intercept), extra)
if (trainingSummary.isDefined) newModel.setSummary(trainingSummary.get)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just checking, was this intended as well? does it need to happen for LinearRegression too? LGTM otherwise.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's needed. Because after we new LogisticRegressionModel or LinearRegressionModel, the default value of trainingSummary is None. So we should also copy trainingSummary explicitly to the new model.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit. newModel.trainingSummary = trainingSummary should work the same.

@SparkQA
Copy link

SparkQA commented Sep 8, 2015

Test build #42130 has finished for PR 8641 at commit 891d29e.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@feynmanliang
Copy link
Contributor

Please add [SPARK-10479] to PR title

@feynmanliang
Copy link
Contributor

LGTM

@asfgit asfgit closed this in 5b2192e Sep 8, 2015
@mengxr
Copy link
Contributor

mengxr commented Sep 8, 2015

Merged into master and branch-1.5. Thanks!

@yanboliang yanboliang changed the title [SPARK-10480] [ML] Fix ML.LinearRegressionModel.copy() [[SPARK-10479]] [SPARK-10480] [ML] Fix ML.LinearRegressionModel.copy() Sep 9, 2015
@yanboliang yanboliang changed the title [[SPARK-10479]] [SPARK-10480] [ML] Fix ML.LinearRegressionModel.copy() [SPARK-10479] [SPARK-10480] [ML] Fix ML.LinearRegressionModel.copy() Sep 9, 2015
@yanboliang yanboliang deleted the linear-regression-copy branch September 9, 2015 02:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants