GitHub user HyukjinKwon opened a pull request:

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

    [MINOR][PYTHON][EXAMPLE] Fix binary classification metrics example to work

    ## What changes were proposed in this pull request?
    
    LibSVM datasource loads `ml.linalg.SparseVector` whereas the examples 
requires it to be `mllib.linalg.SparseVector`.  Scala exmaples, 
`BinaryClassificationMetricsExample.scala` is fine.
    
    ```
      File 
".../spark/examples/src/main/python/mllib/binary_classification_metrics_example.py",
 line 39, in <lambda>
        .rdd.map(lambda row: LabeledPoint(row[0], row[1]))
      File ".../spark/python/pyspark/mllib/regression.py", line 54, in __init__
        self.features = _convert_to_vector(features)
      File ".../spark/python/pyspark/mllib/linalg/__init__.py", line 80, in 
_convert_to_vector
        raise TypeError("Cannot convert type %s into Vector" % type(l))
    TypeError: Cannot convert type <class 'pyspark.ml.linalg.SparseVector'> 
into Vector
    ```
    
    ## How was this patch tested?
    
    Manually via
    
    ```
    ./bin/spark-submit 
examples/src/main/python/mllib/binary_classification_metrics_example.py
    ```

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

    $ git pull https://github.com/HyukjinKwon/spark minor-example-fix

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

    https://github.com/apache/spark/pull/16515.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 #16515
    
----
commit 9a4fd40609d6ef71dc3fd3db0f72502eb3f070f0
Author: hyukjinkwon <[email protected]>
Date:   2017-01-09T10:31:15Z

    Fix binary classification metrics example to work

----


---
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