Exemplo n.º 1
0
    Z = set(Y)
    M = [[z,Y.count(z)] for z in Z]
    M.sort()
    M.reverse()
    X = [data[0] for data in M]
    Y = [data[1] for data in M]
    '''
    #Y = [sum(Y[:i]) / float(len(gps_data)) for i in range(1,len(M) + 1,1)]
    '''
    plt.bar(X, Y, width=0.25)
    plt.show()
    '''
    #pylab.plot(X,Y,'o')
    #pylab.show()

    labels, centers = sciencecluster.science_cluster(numpy.array(gps_data),
                                                     cutoff_distance=0.0000001)
    save_gps_data(gps_data, labels)
    '''
    eps = 0.00001
    min_samples = 15
    metric = 'euclidean'
    core_samples, labels = sklearn.cluster.dbscan(numpy.array(gps_data), metric=metric, eps=eps,min_samples=min_samples)
    print labels[:100]
    '''
    '''
    X = [data[0] for data in gps_data]
    Y = [data[1] for data in gps_data]
    ax1 = pylab.subplot(211)
    ax2 = pylab.subplot(212)
    pylab.sca(ax1)
    for i in range(len(X)):
Exemplo n.º 2
0
def science_cluster(gps_data,number,show = False):
    labels,centers = sciencecluster.science_cluster(numpy.array(gps_data),num = number,cutoff_distance = 0.000005,experience = 0.000811,show = show) #0.0003 \\0.0001
    return centers,labels
Exemplo n.º 3
0
 Z = set(Y)
 M = [[z,Y.count(z)] for z in Z]
 M.sort()
 M.reverse()
 X = [data[0] for data in M]
 Y = [data[1] for data in M]
 '''
 #Y = [sum(Y[:i]) / float(len(gps_data)) for i in range(1,len(M) + 1,1)]
 '''
 plt.bar(X, Y, width=0.25)
 plt.show()
 '''
 #pylab.plot(X,Y,'o')
 #pylab.show()
 
 labels,centers = sciencecluster.science_cluster(numpy.array(gps_data),cutoff_distance = 0.0000001)
 save_gps_data(gps_data,labels)
 '''
 eps = 0.00001
 min_samples = 15
 metric = 'euclidean'
 core_samples, labels = sklearn.cluster.dbscan(numpy.array(gps_data), metric=metric, eps=eps,min_samples=min_samples)
 print labels[:100]
 '''
 '''
 X = [data[0] for data in gps_data]
 Y = [data[1] for data in gps_data]
 ax1 = pylab.subplot(211)
 ax2 = pylab.subplot(212)
 pylab.sca(ax1)
 for i in range(len(X)):