def HAR_Regularizer(ls_graph, ls_lb_tr, str_file, ls_lb_tl): ls_lb_nu = src.copy_list(ls_lb_tr) ls_lb_tlnu = src.copy_list(ls_lb_tl) src.configureLabels(ls_lb_nu, 0, -1) src.configureLabels(ls_lb_tlnu, 0, -1) #raw_input("--pausa-- "); flo_timestart = time() mtx_lb_pr = src.HarmonicRegularizer(ls_graph, ls_lb_nu) flo_timefinal = time() - flo_timestart # Getting Results ls_lb_pr = src.convert_to_list(mtx_lb_pr) ls_lb_prflo = src.float_list_normalization(ls_lb_pr) ls_temp_lb = ls_lb_prflo np.savetxt("Pr" + str_file, (tuple(ls_temp_lb) + tuple(ls_lb_tlnu))) ls_lb_alpha = src.generalizeAlphaCut(np.array(ls_lb_pr), 0, -1, 1) ls_lb_alphaint = src.int_list_normalization(ls_lb_alpha) flo_acc = src.accuracyTest(ls_lb_alphaint, ls_lb_tlnu) flo_TP, flo_TN, flo_FP, flo_FN = src.confussionMatrix( ls_lb_alphaint, ls_lb_tlnu) np.savetxt("Rs" + str_file, (flo_TP, flo_TN, flo_FP, flo_FN, flo_acc, flo_timefinal)) print str_file + " done!" return ls_lb_pr
#----- (begin) K GRAPH CONSTRUCTION (begin) -----# str_graph_type = "K" floint_graph_hyper = 2 timestart = time() Gr_K = src.buildKGraph(data_proc, 2) # ----> Construction Method timefinal_gc = time() - timestart #----- (end) FULL GRAPH CONSTRUCTION (end) -----# #----- (begin) HARMONIC REGULARIZATION (begin) -----# print "< < Harmonic > >" # Checking Regularization str_reg_type = "Har" timestart = time() respH = src.HarmonicRegularizer(Gr_K, label_proc) # --------------------> Regulating timefinal_gr = time() - timestart respH = src.convert_to_list(respH) # Converting to list, the result of the regulation dataH = src.float_list_normalization(respH) # Mapping results as floats temp_respH = dataH string_nome_data_temp = string_nome_data + str_graph_type + str( floint_graph_hyper) + str_reg_type + "L" + str(int_per) + "%.txt" # Saving results of data np.savetxt(string_nome_data_temp, (temp_respH)) repH = src.generalizeAlphaCut(np.array(respH), 0.5, 0, 1)