Esempio n. 1
0
def demo():
    mode = 2
    outs = '../output/'
    ins_gfeat = '../example/outd2hub_feature'
    outs = '../output/'
    ofn_hist = 'histogram.out'
    ofn_node2hcel = 'node2hcel.out'
    ofn_hcel2avgfeat = 'hcel2avgfeat.out'
    ofn_heatmap = 'heatmap.png'
    x_lab, y_lab = [
        "Hubness", "Out-degree"
    ]  # ["Authority", "In-degree"], ["PageRank", "Degree"], ["Degree", "Triangles"]

    loader = Loader()
    m, _, gfts = loader.load_features(ins_gfeat, float)
    histogram_construct(gfts[:m], 1, outs + ofn_hist, outs + ofn_node2hcel,
                        outs + ofn_hcel2avgfeat, mode)
    histogram_view(outs + ofn_hist, x_lab, y_lab, outs + ofn_heatmap)
Esempio n. 2
0
    csr_mat = csr_matrix((hist_arr[:, -1], (hist_arr[:, 0], hist_arr[:, 1])),
                         shape=_shape_,
                         dtype=int)
    plot_heatmap(ticks_vec[1],
                 ticks_vec[0],
                 csr_mat.toarray(),
                 xlabel=xlabel,
                 ylabel=ylabel,
                 outfn=outfn)
    # plot_heatmap_graphlab_pgrk(ticks_vec[1], ticks_vec[0], csr_mat.toarray(), xlabel=xlabel, ylabel=ylabel, outfn=outfn)
    # plot_heatmap_2discretes(ticks_vec[1], ticks_vec[0], csr_mat.toarray(), xlabel=xlabel, ylabel=ylabel, outfn=outfn)
    print('Histogram view done!')


if __name__ == '__main__':
    ins_gfeat = '../example/outd2hub_feature'
    outs = '../output/'
    outs_hist = 'histogram.out'
    ofn_node2hcel = 'node2hcel.out'
    ofn_hcel2avgfeat = 'hcel2avgfeat.out'
    ofn_heatmap = 'heatmap.png'
    x_lab, y_lab = ["Hubness", "Out-degree"]
    # ["Authoritativeness", "In-degree"], ["PageRank", "Degree"], ["Degree", "Triangles"]

    mode = 2
    loader = Loader()
    m, _, gfts = loader.load_features(ins_gfeat, float)
    histogram_construct(gfts[:m], 1, outs + outs_hist, outs + ofn_node2hcel,
                        outs + ofn_hcel2avgfeat, mode)
    histogram_view(outs + outs_hist, x_lab, y_lab, outs + ofn_heatmap)