Exemple #1
0
modularities = []
n_communities = []
labels = []
modularities_base = []
n_communities_base = []
modification_number = 20
modification_percent = 0.2
for modification, modification_type in zip([False, True, True], ["percent", "percent", "number"]):
    this_times = []
    this_nmis = []
    this_mods = []
    this_ncoms = []
    this_mods_base = []
    this_coms_base = []
    for N in N_list:
        time, nmi, mod_ndocd, mod_base, n_coms, n_coms_base = test_ndocd(folder, file_appending="b2_" + str(N), MD_threshold=0.3, JS_threshold=0.3, modification=modification, modification_type=modification_type, modification_number=modification_number, modification_percent=modification_percent)
        this_times.append(time)
        this_nmis.append(nmi)
        this_mods.append(mod_ndocd)
        this_ncoms.append(n_coms)
        this_mods_base.append(mod_base)
        this_coms_base.append(n_coms_base)
        print(f'Ended: N - {N}, time - {time} \n')
    times.append(this_times)
    nmis.append(this_nmis)
    modularities.append(this_mods)
    n_communities.append(this_ncoms)
    labels.append(f"N = {N}")
    modularities_base.append(this_mods_base)
    n_communities_base.append(this_coms_base)
    print(f'\n\n Ended: modification, modification_type - {modification, modification_type} \n\n')
Exemple #2
0
modularities = []
n_communities = []
labels = []
modularities_base = []
n_communities_base = []
JS_thresholds = [0.1, 0.2, 0.3, 0.4, 0.5, 0.7, 0.9]
MD_thresholds = [0.1, 0.2, 0.3, 0.4, 0.5, 0.7, 0.9]
for N in N_list:
    for mu in mu_list:
        for on_over_n in on_over_n_list:
            this_times = []
            this_nmis = []
            this_mods = []
            this_ncoms = []
            for JS_threshold, MD_threshold in zip(JS_thresholds, MD_thresholds):
                time, nmi, mod_ndocd, mod_base, n_coms, n_coms_base = test_ndocd(folder, file_appending="b3_" + str(N) + str(mu) + str(on_over_n), MD_threshold=MD_threshold, JS_threshold=JS_threshold)
                this_times.append(time)
                this_nmis.append(nmi)
                this_mods.append(mod_ndocd)
                this_ncoms.append(n_coms)
                print(f'Ended: JS_threshold - {JS_threshold}, N - {N}, time - {time} \n')
            times.append(this_times)
            nmis.append(this_nmis)
            modularities.append(this_mods)
            n_communities.append(this_ncoms)
            labels.append(f"N = {N}, mu = {mu} on = {int(N*on_over_n)}")
            modularities_base.append(mod_base)
            n_communities_base.append(n_coms_base)
            print(f'\n\n Ended: N - {N} \n\n')

modification_numbers = [5, 10, 20, 30, 40, 50]
MD_threshold = 0.3
JS_threshold = 0.3
for N in N_list:
    for mu in mu_list:
        for on_over_n in on_over_n_list:
            this_times = []
            this_nmis = []
            this_mods = []
            this_ncoms = []
            for modification_percent in modification_percents:
                time, nmi, mod_ndocd, mod_base, n_coms, n_coms_base = test_ndocd(
                    folder,
                    file_appending="b3_" + str(N) + str(mu) + str(on_over_n),
                    MD_threshold=MD_threshold,
                    JS_threshold=JS_threshold,
                    modification=True,
                    modification_percent=modification_percent,
                    modification_number=10,
                    modification_type="percent")
                this_times.append(time)
                this_nmis.append(nmi)
                this_mods.append(mod_ndocd)
                this_ncoms.append(n_coms)
                print(
                    f'Ended: percent - {modification_percent}, N - {N}, time - {time} \n'
                )
            times.append(this_times)
            nmis.append(this_nmis)
            modularities.append(this_mods)
            n_communities.append(this_ncoms)