def histogram_view(ins_hist, x_lab, y_lab, outs_viz=None): loader = Loader() _shape_, ticks_vec, hist_arr = loader.load_multi_histogram(ins_hist) 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=x_lab, ylabel=y_lab, outfn=outs_viz) # plot_heatmap_graphlab_pgrk(ticks_vec[1], ticks_vec[0], csr_mat.toarray(), xlabel=x_lab, ylabel=y_lab, outfn=outs_viz) # plot_heatmap_2discretes(ticks_vec[1], ticks_vec[0], csr_mat.toarray(), xlabel=x_lab, ylabel=y_lab, outfn=outs_viz) print('done!')
def histogram_view(histogram_infn, xlabel, ylabel, outfn=None): loader = Loader() _shape_, ticks_vec, hist_arr = loader.load_multi_histogram(histogram_infn) 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!')
verbose=False, outfn=os.path.join(outpath, tiny_blobs)) print("Refine tree structure.") print("a). tree contract") tree.tree_contract(VERBOSE) tree.save_leveltree(os.path.join(outpath, contracttree)) print("b). tree pruned") tree.tree_prune(alpha=0.8, verbose=VERBOSE) tree.save_leveltree(os.path.join(outpath, prunetree)) print("c). tree node expand") tree.tree_node_expand(VERBOSE) tree.save_leveltree(os.path.join(outpath, refinetree)) tree.dump() if __name__ == '__main__': path = '../output/' histogram_infn = 'histogram.out' loader = Loader() print("load data") shape, ticks_vec, hist_arr = loader.load_multi_histogram( os.path.join(path, histogram_infn)) mode = len(shape) print("Info: mode:{} shape:{}".format(mode, shape)) waterleveltree(hist_arr, path) print("done!")