jupyter-incubator / sparkmagic

Jupyter magics and kernels for working with remote Spark clusters
Other
1.33k stars 447 forks source link

BinaryClassificationMetrics are not working #517

Open fdegier opened 5 years ago

fdegier commented 5 years ago

When using the BinaryClassificationMetrics there is an error, possible related to conversion of data types. This only occurs when using Sparkmagic and Livy.

Input:

from pyspark.sql import SparkSession   
import pyspark
from pyspark.mllib.evaluation import BinaryClassificationMetrics

a = sc.parallelize([
    (0.0, 1.0), (0.0, 1.0), (0.0, 1.0), (0.0, 1.0), (0.0, 1.0), 
    (0.0, 1.0), (0.0, 1.0), (0.0, 1.0), (0.0, 1.0), (0.0, 1.0), 
    (0.0, 1.0), (0.0, 1.0), (0.0, 0.0), (0.0, 0.0), (0.0, 0.0), 
    (0.0, 0.0), (0.0, 0.0), (0.0, 0.0), (0.0, 0.0), (0.0, 0.0), 
    (0.0, 0.0), (0.0, 0.0), (0.0, 0.0), (0.0, 0.0), (0.0, 0.0)
])  

metrics = BinaryClassificationMetrics(a)

Output:

'StructField' object has no attribute '_get_object_id' 
hnikana commented 4 years ago

Any solution ?