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-29867][ML][PYTHON] Add __repr__ in Python ML Models #26489
Conversation
Test build #113651 has finished for PR 26489 at commit
|
python/pyspark/ml/classification.py
Outdated
@@ -356,6 +356,9 @@ def intercept(self): | |||
""" | |||
return self._call_java("intercept") | |||
|
|||
def __repr__(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we put this method to some common class (like JavaModel
) and add __repr__
only in classes not extending JavaModel
(like OneVsRestModel
) ?
Test build #113797 has finished for PR 26489 at commit
|
Test build #113799 has finished for PR 26489 at commit
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, good change. Looks OK pending tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1, LGTM. The common __repl__
is nice.
Thank you, @huaxingao , @zhengruifeng , @srowen .
Merged to master.
Thanks! @dongjoon-hyun @srowen @zhengruifeng |
What changes were proposed in this pull request?
Add
__repr__
in Python ML ModelsWhy are the changes needed?
In Python ML Models, some of them have
__repr__
, others don't. In the doctest, when calling Model.setXXX, some of the Models print out the xxxModel... correctly, some of them can't because of lacking the__repr__
method. For example:After the change, the above code will become the following:
Does this PR introduce any user-facing change?
Yes.
How was this patch tested?
doctest