In [1]:
from sklearn import datasets
import json
import numpy as np
import urllib, urllib2
In [10]:
def plotVR(x, col, host="http://localhost:2908"):
data = np.hstack((x[:,:3],col.reshape((-1,1))))
# todo: remove NAs, center and scale...
data_json = json.dumps({'data': data.tolist(),'speed': 0}, allow_nan=False)
urllib2.urlopen(host, bytearray(data_json))
iris = datasets.load_iris()
plotVR(iris.data, iris.target)
In [3]:
iris.data.tolist()
?urllib2.urlopen
In [ ]: