aboutsummaryrefslogtreecommitdiff
path: root/mllib/src
diff options
context:
space:
mode:
authorSandy Ryza <sandy@cloudera.com>2014-10-06 14:05:45 -0700
committerJosh Rosen <joshrosen@apache.org>2014-10-06 14:05:45 -0700
commit20ea54cc7a5176ebc63bfa9393a9bf84619bfc66 (patch)
tree695790ecc7bf11d7165a24914da36b957213fdf3 /mllib/src
parentc9ae79fba25cd49ca70ca398bc75434202d26a97 (diff)
downloadspark-20ea54cc7a5176ebc63bfa9393a9bf84619bfc66.tar.gz
spark-20ea54cc7a5176ebc63bfa9393a9bf84619bfc66.tar.bz2
spark-20ea54cc7a5176ebc63bfa9393a9bf84619bfc66.zip
[SPARK-2461] [PySpark] Add a toString method to GeneralizedLinearModel
Add a toString method to GeneralizedLinearModel, also change `__str__` to `__repr__` for some classes, to provide better message in repr. This PR is based on #1388, thanks to sryza! closes #1388 Author: Sandy Ryza <sandy@cloudera.com> Author: Davies Liu <davies.liu@gmail.com> Closes #2625 from davies/string and squashes the following commits: 3544aad [Davies Liu] fix LinearModel 0bcd642 [Davies Liu] Merge branch 'sandy-spark-2461' of github.com:sryza/spark 1ce5c2d [Sandy Ryza] __repr__ back to __str__ in a couple places aa9e962 [Sandy Ryza] Switch __str__ to __repr__ a0c5041 [Sandy Ryza] Add labels back in 1aa17f5 [Sandy Ryza] Match existing conventions fac1bc4 [Sandy Ryza] Fix PEP8 error f7b58ed [Sandy Ryza] SPARK-2461. Add a toString method to GeneralizedLinearModel
Diffstat (limited to 'mllib/src')
-rw-r--r--mllib/src/main/scala/org/apache/spark/mllib/regression/GeneralizedLinearAlgorithm.scala2
1 files changed, 2 insertions, 0 deletions
diff --git a/mllib/src/main/scala/org/apache/spark/mllib/regression/GeneralizedLinearAlgorithm.scala b/mllib/src/main/scala/org/apache/spark/mllib/regression/GeneralizedLinearAlgorithm.scala
index d0fe417968..00dfc86c9e 100644
--- a/mllib/src/main/scala/org/apache/spark/mllib/regression/GeneralizedLinearAlgorithm.scala
+++ b/mllib/src/main/scala/org/apache/spark/mllib/regression/GeneralizedLinearAlgorithm.scala
@@ -75,6 +75,8 @@ abstract class GeneralizedLinearModel(val weights: Vector, val intercept: Double
def predict(testData: Vector): Double = {
predictPoint(testData, weights, intercept)
}
+
+ override def toString() = "(weights=%s, intercept=%s)".format(weights, intercept)
}
/**