示例#1
0
def main():
    hsic_lasso = HSICLasso()
    hsic_lasso.input("../tests/test_data/matlab_data.mat")

    #max_neighbors=0 means that we only use the HSIC Lasso features to plot heatmap
    hsic_lasso.regression(5, max_neighbors=0)

    #Compute linkage
    hsic_lasso.linkage()

    #Run Hierarchical clustering
    # Features are clustered by using HSIC scores
    # Samples are clusterd by using Euclid distance
    hsic_lasso.plot_heatmap()
示例#2
0
    - HL_SELECT: number of features to select.
    - HL_B: size of the block.
    - HL_M: number of permutations.
Output files:
    - features_hl.npy: numpy array with the 0-based index of 
    the selected features.
'''

import numpy as np
from pyHSICLasso import HSICLasso

hl = HSICLasso()

np.random.seed(0)
hl.X_in = np.load("${X_TRAIN}").T
hl.Y_in = np.load("${Y_TRAIN}").T
hl.Y_in = np.expand_dims(hl.Y_in, 0)
hl.featname = np.load("${FEATNAMES}")

try:
    hl.${MODE}($HL_SELECT, B = $HL_B, M = $HL_M, max_neighbors = 50)
except MemoryError:
    import sys, traceback
    traceback.print_exc()
    np.save('features_hl.npy', np.array([]))
    sys.exit(77)

hl.linkage()
hl.plot_dendrogram()
hl.plot_heatmap()