You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by yanboliang <gi...@git.apache.org> on 2015/03/16 08:25:34 UTC
[GitHub] spark pull request: [SPARK-6291] [MLLIB] GLM toString & toDebugStr...
GitHub user yanboliang opened a pull request:
https://github.com/apache/spark/pull/5038
[SPARK-6291] [MLLIB] GLM toString & toDebugString
GLM toString prints out intercept, numFeatures.
For LogisticRegression and SVM model, toString also prints out numClasses, threshold.
GLM toDebugString prints out the whole weights, intercept.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/yanboliang/spark spark-6291
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/5038.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #5038
----
commit 1e8a02385d705daab60d7e6209434fae7421b3e8
Author: Yanbo Liang <yb...@gmail.com>
Date: 2015-03-16T07:06:27Z
GLM toString & toDebugString
----
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request: [SPARK-6291] [MLLIB] GLM toString & toDebugStr...
Posted by srowen <gi...@git.apache.org>.
Github user srowen commented on the pull request:
https://github.com/apache/spark/pull/5038#issuecomment-83105312
LGTM. Will wait a short time for more comments.
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request: [SPARK-6291] [MLLIB] GLM toString & toDebugStr...
Posted by srowen <gi...@git.apache.org>.
Github user srowen commented on a diff in the pull request:
https://github.com/apache/spark/pull/5038#discussion_r26485785
--- Diff: mllib/src/main/scala/org/apache/spark/mllib/regression/GeneralizedLinearAlgorithm.scala ---
@@ -76,7 +76,17 @@ abstract class GeneralizedLinearModel(val weights: Vector, val intercept: Double
predictPoint(testData, weights, intercept)
}
- override def toString() = "(weights=%s, intercept=%s)".format(weights, intercept)
+ /**
+ * Print a summary of the model.
+ */
+ override def toString: String = {
+ this.getClass.getName + " : " + s"intercept = $intercept, numFeatures = ${weights.size}"
+ }
+
+ /**
+ * Print the full model to a string.
+ */
+ def toDebugString: String = "(weights=%s, intercept=%s)".format(weights, intercept)
--- End diff --
... or really if someone wants to access the weights for debugging, won't they do so directly? this doesn't add much as a second `toString` method.
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request: [SPARK-6291] [MLLIB] GLM toString & toDebugStr...
Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:
https://github.com/apache/spark/pull/5038#issuecomment-82746937
[Test build #28774 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/28774/consoleFull) for PR 5038 at commit [`2f578b0`](https://github.com/apache/spark/commit/2f578b06ad17a4f70488daa67e8e5bccd9445df4).
* This patch merges cleanly.
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request: [SPARK-6291] [MLLIB] GLM toString & toDebugStr...
Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:
https://github.com/apache/spark/pull/5038
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request: [SPARK-6291] [MLLIB] GLM toString & toDebugStr...
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:
https://github.com/apache/spark/pull/5038#issuecomment-81509233
Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/28640/
Test PASSed.
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request: [SPARK-6291] [MLLIB] GLM toString & toDebugStr...
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:
https://github.com/apache/spark/pull/5038#issuecomment-82349810
Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/28719/
Test PASSed.
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request: [SPARK-6291] [MLLIB] GLM toString & toDebugStr...
Posted by srowen <gi...@git.apache.org>.
Github user srowen commented on the pull request:
https://github.com/apache/spark/pull/5038#issuecomment-82359681
Now this doesn't use string interpolation at all, which is the opposite of what I suggested. I think it's better to use string interpolation, and use it consistently. I also personally do not see the value in `toDebugString` as the result is still potentially huge, and those who want access to the weights can access them directly anyway.
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request: [SPARK-6291] [MLLIB] GLM toString & toDebugStr...
Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:
https://github.com/apache/spark/pull/5038#issuecomment-81464575
[Test build #28640 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/28640/consoleFull) for PR 5038 at commit [`1e8a023`](https://github.com/apache/spark/commit/1e8a02385d705daab60d7e6209434fae7421b3e8).
* This patch merges cleanly.
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request: [SPARK-6291] [MLLIB] GLM toString & toDebugStr...
Posted by srowen <gi...@git.apache.org>.
Github user srowen commented on a diff in the pull request:
https://github.com/apache/spark/pull/5038#discussion_r26485545
--- Diff: mllib/src/main/scala/org/apache/spark/mllib/classification/LogisticRegression.scala ---
@@ -163,6 +163,10 @@ class LogisticRegressionModel (
}
override protected def formatVersion: String = "1.0"
+
+ override def toString: String = {
+ super.toString + s", numClasses = $numClasses, threshold = ${threshold}"
--- End diff --
Trivial: this line uses both braces and no-braces for variables the interpolation. It's not needed in either case. The superclass `toString` is like `(weights=..., intercept=...)` so it feels a little inconsistent to continue it with `, numClasses = ...`. How about making the superclass method consistent with this?
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request: [SPARK-6291] [MLLIB] GLM toString & toDebugStr...
Posted by srowen <gi...@git.apache.org>.
Github user srowen commented on a diff in the pull request:
https://github.com/apache/spark/pull/5038#discussion_r26485698
--- Diff: mllib/src/main/scala/org/apache/spark/mllib/regression/GeneralizedLinearAlgorithm.scala ---
@@ -76,7 +76,17 @@ abstract class GeneralizedLinearModel(val weights: Vector, val intercept: Double
predictPoint(testData, weights, intercept)
}
- override def toString() = "(weights=%s, intercept=%s)".format(weights, intercept)
+ /**
+ * Print a summary of the model.
+ */
+ override def toString: String = {
+ this.getClass.getName + " : " + s"intercept = $intercept, numFeatures = ${weights.size}"
+ }
+
+ /**
+ * Print the full model to a string.
+ */
+ def toDebugString: String = "(weights=%s, intercept=%s)".format(weights, intercept)
--- End diff --
Why not make this use string interpolation too and use the same format?
Also, above in `toString`, why use string concatenation and interpolation? just use interpolation
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request: [SPARK-6291] [MLLIB] GLM toString & toDebugStr...
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:
https://github.com/apache/spark/pull/5038#issuecomment-82780219
Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/28774/
Test PASSed.
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request: [SPARK-6291] [MLLIB] GLM toString & toDebugStr...
Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:
https://github.com/apache/spark/pull/5038#issuecomment-82780195
[Test build #28774 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/28774/consoleFull) for PR 5038 at commit [`2f578b0`](https://github.com/apache/spark/commit/2f578b06ad17a4f70488daa67e8e5bccd9445df4).
* This patch **passes all tests**.
* This patch merges cleanly.
* This patch adds no public classes.
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request: [SPARK-6291] [MLLIB] GLM toString & toDebugStr...
Posted by yanboliang <gi...@git.apache.org>.
Github user yanboliang commented on the pull request:
https://github.com/apache/spark/pull/5038#issuecomment-82787376
@srowen , sorry for the misunderstand. I have change to use string interpolation and delete ```toDebugString``` which may be useless.
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request: [SPARK-6291] [MLLIB] GLM toString & toDebugStr...
Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:
https://github.com/apache/spark/pull/5038#issuecomment-81509196
[Test build #28640 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/28640/consoleFull) for PR 5038 at commit [`1e8a023`](https://github.com/apache/spark/commit/1e8a02385d705daab60d7e6209434fae7421b3e8).
* This patch **passes all tests**.
* This patch merges cleanly.
* This patch adds no public classes.
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request: [SPARK-6291] [MLLIB] GLM toString & toDebugStr...
Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:
https://github.com/apache/spark/pull/5038#issuecomment-82314396
[Test build #28719 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/28719/consoleFull) for PR 5038 at commit [`78b33f2`](https://github.com/apache/spark/commit/78b33f202e988b49134be364a5b052d93285b653).
* This patch merges cleanly.
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request: [SPARK-6291] [MLLIB] GLM toString & toDebugStr...
Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:
https://github.com/apache/spark/pull/5038#issuecomment-82349773
[Test build #28719 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/28719/consoleFull) for PR 5038 at commit [`78b33f2`](https://github.com/apache/spark/commit/78b33f202e988b49134be364a5b052d93285b653).
* This patch **passes all tests**.
* This patch merges cleanly.
* This patch adds no public classes.
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org