Ejemplo n.º 1
0
def dtwrep():
    print "-----DTW-patient------------"
    labels=[random.choice(lab) for i in range(0,250) ]
    p_data= np.stack([np.random.random((3000,4))]*250)
    print "originaltransp",p_data.shape

    distance_file="dist"
    dtw_square_distance_matrix = distance_metric.dtw_distance_matrix(p_data, distance_file + '_dtw', recompute=True)
    print  'matrix loaded'
    Y_2 = mtsne.distance_tsne(dtw_square_distance_matrix, 2)
    print labels
    #Y_3 = mtsne.similarity_tsne(similarity_matrix, 3)
    graph_plot.graf_with_scale('DTWDataRepeated',Y_2, labels)
    #graph_plot.dump_graph(Y_3, labels,'eros_4v_'+patient,labels,3)
    Y_2=[]
    p_data=[]
    labels=[]
Ejemplo n.º 2
0
def erosrep():
    labels=[random.choice(lab) for i in range(0,500) ]
    p_data= np.stack([np.random.random((3000,4))]*100)
    print "originaltransp",p_data.shape

    np.savetxt(similarity_file, eros.eros(p_data).reshape((len(p_data), 1, len(p_data)))) 
    similarity_matrix = np.loadtxt(similarity_file)

    print  'matrix loaded' #Y_2_d = mtsne.distance_tsne(similarity_matrix, 2)  
    Y_2_s = mtsne.similarity_tsne(similarity_matrix, 2)  
    print labels
    #Y_3 = mtsne.similarity_tsne(similarity_matrix, 3)
    graph_plot.graf_with_scale('erosDataRepeated',Y_2_s, labels)
    #graph_plot.dump_graph(Y_3, labels,'eros_4v_'+patient,labels,3)  eros_4v_zoomST7132J0
    Y_2_s=[]
    p_data=[]
    labels=[]
Ejemplo n.º 3
0
def dtw(patient):
    print "-----DTW-patient------------",patient
    data,labels=connection.get_data_pp(patient,4)
    print "original", data.shape
    p_data=[ np.transpose(i) for i in data]
    p_data=np.array(p_data)
    print "originaltransp",p_data.shape
    distance_file="dist"
    dtw_square_distance_matrix = distance_metric.dtw_distance_matrix(p_data, distance_file + '_dtw', recompute=True)
    print  'matrix loaded'
    Y_2 = mtsne.distance_tsne(dtw_square_distance_matrix, 2)
    print labels
    #Y_3 = mtsne.similarity_tsne(similarity_matrix, 3)
    graph_plot.graf_with_scale('Ldtw_4v_'+patient,Y_2, labels)
    #graph_plot.dump_graph(Y_3, labels,'eros_4v_'+patient,labels,3)
    Y_2=[]
    p_data=[]
    labels=[]
Ejemplo n.º 4
0
def eross(patient):

    print "------patient------------",patient
    data,labels=connection.get_data_pp(patient,4)
    #data,labels=read_data(lab,files,3,10,3000)#connection.get_data_1v()#read_data(lab,files,1,20,3000)
    print "original", data.shape
    p_data=[ np.transpose(i) for i in data]
    p_data=np.array(p_data)
    print "originaltransp",p_data.shape

    np.savetxt(similarity_file, eros.eros(p_data).reshape((len(p_data), 1, len(p_data)))) 
    similarity_matrix = np.loadtxt(similarity_file)

    print  'matrix loaded' #Y_2_d = mtsne.distance_tsne(similarity_matrix, 2)  
    Y_2_s = mtsne.similarity_tsne(similarity_matrix, 2)  
    print labels
    #Y_3 = mtsne.similarity_tsne(similarity_matrix, 3)
    graph_plot.graf_with_scale('Leros_4v_scaled'+patient,Y_2_s, labels)
    #graph_plot.dump_graph(Y_3, labels,'eros_4v_'+patient,labels,3)
    Y_2_s=[]
    p_data=[]
    labels=[]