Skip to content

Commit

Permalink
[SPARK-19270][FOLLOW-UP][ML] PySpark GLR model.summary should return …
Browse files Browse the repository at this point in the history
…a printable representation.

## What changes were proposed in this pull request?
PySpark GLR ```model.summary``` should return a printable representation by calling Scala ```toString```.

## How was this patch tested?
```
from pyspark.ml.regression import GeneralizedLinearRegression
dataset = spark.read.format("libsvm").load("data/mllib/sample_linear_regression_data.txt")
glr = GeneralizedLinearRegression(family="gaussian", link="identity", maxIter=10, regParam=0.3)
model = glr.fit(dataset)
model.summary
```
Before this PR:
![image](https://user-images.githubusercontent.com/1962026/29021059-e221633e-7b96-11e7-8d77-5d53f89c81a9.png)
After this PR:
![image](https://user-images.githubusercontent.com/1962026/29021097-fce80fa6-7b96-11e7-8ab4-7e113d447d5d.png)

Author: Yanbo Liang <[email protected]>

Closes apache#18870 from yanboliang/spark-19270.
  • Loading branch information
yanboliang committed Aug 8, 2017
1 parent fdcee02 commit f763d84
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions python/pyspark/ml/regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -1745,6 +1745,9 @@ def pValues(self):
"""
return self._call_java("pValues")

def __repr__(self):
return self._call_java("toString")


if __name__ == "__main__":
import doctest
Expand Down

0 comments on commit f763d84

Please sign in to comment.