Beispiel #1
0
def compute_gbvp_clusters(distance_matrix):
    """
    Paritions the attributes of a data frame using GBVP.

    Input:A dataftame representing a distance matrix between sets of attributes
    Output: A list of lists representing the partioned columns
    """
    return [[distance_matrix.columns[idx] for idx in a_partition] for a_partition in GBVP.get_components(distance_matrix.values.tolist())]
Beispiel #2
0
__author__ = 'kushasharma'
from GBVP import GBVP


SAMPLE_MAT = [[0,  25,  25,   0,  75,   0,  50,  25,  25,   0],
              [25,   0,  75,   0,  25,   0,  60, 110,  75,   0],
              [25,  75,   0,  15,  25,  15,  25,  75, 115,  15],
              [0,    0,  15,   0,   0,  40,   0,   0,  15,  40],
              [75,  25,  25,   0,   0,   0,  50,  25,  25,   0],
              [0,    0,  15,  40,   0,   0,   0,   0,  15,  40],
              [50,  60,  25,   0,  50,   0,   0,  60,  25,   0],
              [25, 110,  75,   0,  25,   0,  60,   0,  75,   0],
              [25,  75, 115,  15,  25,  15,  25,  75,   0,  15],
              [0,   0,  15,  40,   0,  40,   0,   0,  15,   0]]

ADJ_MAT = SAMPLE_MAT
LENGTH = len(ADJ_MAT)

if __name__ == '__main__':
    components = GBVP.get_components(ADJ_MAT)
    print components