In [1]:
%pylab inline
In [2]:
import glob
tcs = glob.glob('ik-learning/tc/tc-*.npy')
print len(tcs), 'tcs found'
In [3]:
tc = vstack([load(tc) for tc in tcs])
print 'mega shape', tc.shape
In [4]:
scatter(tc[:, 0], tc[:, 1])
Out[4]:
In [5]:
scatter(tc[:, 0], tc[:, 2])
Out[5]:
In [6]:
scatter(tc[:, 1], tc[:, 2])
Out[6]:
In [7]:
from mpl_toolkits.mplot3d.axes3d import Axes3D
ax = axes(projection='3d')
ax.scatter(* tc.T)
Out[7]:
In [8]:
from sklearn.cluster import KMeans
K = 150
kmeans = KMeans(K)
kmeans.fit(tc)
Out[8]:
In [9]:
ax = axes(projection='3d')
ax.scatter(* kmeans.cluster_centers_.T)
Out[9]:
In [10]:
save('ik-learning/tc-{}.npy'.format(K), kmeans.cluster_centers_)
In [10]: