示例#1
0
def cluster_transform_matrices(clustering):
    Q = np.zeros([len(clustering), clustering.n], np.float)
    for (idx, center) in enumerate(clustering.clusters):
        Q[idx, np.array(list(center.elements))] = 1.0
    Qi = Q.T
    Q = markov.make_markov_row_stoch(Q)
    return Q, Qi
示例#2
0
def cluster_transform_matrices(clustering):
    Q = np.zeros([len(clustering), clustering.n], np.float)
    for (idx, center) in enumerate(clustering.clusters):
        Q[idx, np.array(list(center.elements))] = 1.0
    Qi = Q.T
    Q = markov.make_markov_row_stoch(Q)
    return Q, Qi
示例#3
0
def cluster_transform(diffusion, clustering):
    Q = np.zeros([len(clustering), diffusion.shape[0]], np.float)
    for (idx, center) in enumerate(clustering.clusters):
        Q[idx, np.array(list(center.elements))] = 1.0
    Qi = Q.T
    Q = markov.make_markov_row_stoch(Q)
    return Q.dot(diffusion).dot(Qi)
示例#4
0
def cluster_transform(diffusion, clustering):
    Q = np.zeros([len(clustering), diffusion.shape[0]], np.float)
    for (idx, center) in enumerate(clustering.clusters):
        Q[idx, np.array(list(center.elements))] = 1.0
    Qi = Q.T
    Q = markov.make_markov_row_stoch(Q)
    return Q.dot(diffusion).dot(Qi)