GitHub user jonmclean opened a pull request:

    https://github.com/apache/spark/pull/17877

    [SPARK-20615][ML][TEST] SparseVector.argmax throws IndexOutOfBoundsException

    ## What changes were proposed in this pull request?
    
    Added a check for for the number of defined values.  Previously the argmax 
function assumed that at least one value was defined if the vector size was 
greater than zero.
    
    ## How was this patch tested?
    
    Tests were added to the existing VectorsSuite to cover this case.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/jonmclean/spark vectorArgmaxIndexBug

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/17877.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 #17877
    
----
commit 2096430261ca5709f09170c9ac523de0b612025f
Author: Jon McLean <[email protected]>
Date:   2017-05-05T21:01:09Z

    Added tests to illustrate bug SPARK-20615

commit 5614f58f530d3d64a99f6196c39206d749ceb87a
Author: Jon McLean <[email protected]>
Date:   2017-05-05T21:10:07Z

    Made SparseVector.argmax return 0 when no values are defined in the vector. 
 This situation can happen when the SparseVector has a size greater than zero 
but has no defined elements other than zero

----


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to