Exemple #1
0
def getWindows(timeseries,window_size=20,vectorize=True):
    conn_mat = []
    for i in range(0,timeseries.shape[1]-window_size+1,1):
        if vectorize:
            tmp_conn_mat = np.corrcoef(timeseries[:,i:i+window_size])
            if i==0:
                conn_mat = ts.mat2vec(tmp_conn_mat)[np.newaxis,:]
            else:
                conn_mat = np.vstack((conn_mat, ts.mat2vec(tmp_conn_mat)[np.newaxis,:]))
        else:
            tmp_conn_mat = np.corrcoef(timeseries[:,i:i+window_size])
            conn_mat.append(tmp_conn_mat)
    conn_mat = np.array(conn_mat)
    #print conn_mat.shape
    return conn_mat
Exemple #2
0
def getWindowCluster(timeseries,nclusters=12,window_size=20):
    binary_mat = np.array([])
    for i in range(0,timeseries.shape[1]-window_size+1,1):

        clust_ind = hclustering(timeseries[:,i:i+window_size],nclusters)

        tmp_mat = np.array(ind2matrix(clust_ind)>0,dtype=int)

        if i==0:
            binary_mat = ts.mat2vec(tmp_mat)[np.newaxis,:]
        else:
            binary_mat = np.vstack((binary_mat, ts.mat2vec(tmp_mat)[np.newaxis,:]))

    print binary_mat.shape
    return binary_mat
Exemple #3
0
def getWindowCluster(timeseries,nclusters=12,window_size=20):
    binary_mat = np.array([])
    for i in range(0,timeseries.shape[1]-window_size+1,1):

        clust_ind = hclustering(timeseries[:,i:i+window_size],nclusters)

        tmp_mat = np.array(ind2matrix(clust_ind)>0,dtype=int)

        if i==0:
            binary_mat = ts.mat2vec(tmp_mat)[np.newaxis,:]
        else:
            binary_mat = np.vstack((binary_mat, ts.mat2vec(tmp_mat)[np.newaxis,:]))

    print binary_mat.shape
    return binary_mat
Exemple #4
0
def getWindows(timeseries,window_size=20,vectorize=True):
    conn_mat = []
    for i in range(0,timeseries.shape[1]-window_size+1,1):
        if vectorize:
            tmp_conn_mat = np.corrcoef(timeseries[:,i:i+window_size])
            if i==0:
                conn_mat = ts.mat2vec(tmp_conn_mat)[np.newaxis,:]
            else:
                conn_mat = np.vstack((conn_mat, ts.mat2vec(tmp_conn_mat)[np.newaxis,:]))
        else:
            tmp_conn_mat = np.corrcoef(timeseries[:,i:i+window_size])
            conn_mat.append(tmp_conn_mat)
    conn_mat = np.array(conn_mat)
    #print conn_mat.shape
    return conn_mat