-
Notifications
You must be signed in to change notification settings - Fork 28k
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-16328][ML][MLLIB][PYSPARK] Add 'asML' and 'fromML' conversion methods to PySpark linalg #13997
Conversation
Test build #61544 has finished for PR 13997 at commit
|
:param vec: a :py:class:`pyspark.ml.linalg.Vector` | ||
:return: a :py:class:`pyspark.mllib.linalg.Vector` | ||
""" | ||
if type(vec) == newlinalg.DenseVector: |
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.
It's a common pythonic practise to use isinstance
in such cases. If vec is an instance of something that inherits from DenseVector
, then this check will fail.
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.
doh! yeah of course, wasn't thinking. Thanks!
LGTM pending nitpicks. |
Test build #61556 has finished for PR 13997 at commit
|
True | ||
|
||
:param vec: a :py:class:`pyspark.ml.linalg.Vector` | ||
:return: a :py:class:`pyspark.mllib.linalg.Vector` |
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.
versionadded
Looks good, except for a few minor comments |
@jkbradley fair point for the tests - I actually just moved them to |
Test build #61572 has finished for PR 13997 at commit
|
Thanks for the updates! For tests, I'm all for including some doc tests in Python if they provide good examples for the docs. But developers, myself included, have tended to include too much in doc tests in the past. LGTM |
…methods to PySpark linalg The move to `ml.linalg` created `asML`/`fromML` utility methods in Scala/Java for converting between representations. These are missing in Python, this PR adds them. ## How was this patch tested? New doctests. Author: Nick Pentreath <nickp@za.ibm.com> Closes #13997 from MLnick/SPARK-16328-python-linalg-convert. (cherry picked from commit dab1051) Signed-off-by: Joseph K. Bradley <joseph@databricks.com>
The move to
ml.linalg
createdasML
/fromML
utility methods in Scala/Java for converting between representations. These are missing in Python, this PR adds them.How was this patch tested?
New doctests.