Hi, I'm getting trouble to plotting in pyspark

There is a dataframe (col:"features", col:"predictions") which is result from 
kmeans.

And my goal is to plot the feature_vector(x,y) and predictions of kmeans_model.

HERE ARE CODES AND RESULTS


z.put("result", model.transform(norm_featured_2f))

//res~: Object = [norm_2f_features: vector]


%pyspark
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt; plt.rcdefaults()
import numpy as np
import StringIO

def show(p):
    img = StringIO.StringIO()
    p.savefig(img, format='svg')
    img.seek(0)
    print "%html <div style='width:600px'>" + img.buf + "</div>"

data = z["result"]
x = []
y = []
for i in data[0]:
    x.append(i._1())
    y.append(i._2())

//TypeError: 'JavaObject' object is not callable


Anyone help

Is there any sample codes, or notebook about this?


Reply via email to