From 31b0ed811716fd84acab01731bebc564112e4327 Mon Sep 17 00:00:00 2001 From: Luca Lombardo Date: Thu, 10 Mar 2022 22:05:45 +0100 Subject: [PATCH] added script for discrepancy in actors graph --- .../actor_bench/closeness_results/analysis.py | 28 +++++++++++++++++++ .../top_actors_05_c.txt | 0 .../top_actors_10_c.txt | 0 .../top_actors_20_c.txt | 0 .../top_actors_30_c.txt | 0 .../top_actors_40_c.txt | 0 .../top_actors_50_c.txt | 0 .../top_actors_60_c.txt | 0 .../top_actors_70_c.txt | 0 .../top_actors_05_h.txt | 0 .../top_actors_10_h.txt | 0 .../top_actors_20_h.txt | 0 .../top_actors_30_h.txt | 0 .../top_actors_40_h.txt | 0 .../top_actors_50_h.txt | 0 .../top_actors_60_h.txt | 0 .../top_actors_70_h.txt | 0 17 files changed, 28 insertions(+) create mode 100755 scripts/actor_bench/closeness_results/analysis.py rename scripts/actor_bench/{ => closeness_results}/top_actors_05_c.txt (100%) rename scripts/actor_bench/{ => closeness_results}/top_actors_10_c.txt (100%) rename scripts/actor_bench/{ => closeness_results}/top_actors_20_c.txt (100%) rename scripts/actor_bench/{ => closeness_results}/top_actors_30_c.txt (100%) rename scripts/actor_bench/{ => closeness_results}/top_actors_40_c.txt (100%) rename scripts/actor_bench/{ => closeness_results}/top_actors_50_c.txt (100%) rename scripts/actor_bench/{ => closeness_results}/top_actors_60_c.txt (100%) rename scripts/actor_bench/{ => closeness_results}/top_actors_70_c.txt (100%) rename scripts/actor_bench/{ => harmonic_results}/top_actors_05_h.txt (100%) rename scripts/actor_bench/{ => harmonic_results}/top_actors_10_h.txt (100%) rename scripts/actor_bench/{ => harmonic_results}/top_actors_20_h.txt (100%) rename scripts/actor_bench/{ => harmonic_results}/top_actors_30_h.txt (100%) rename scripts/actor_bench/{ => harmonic_results}/top_actors_40_h.txt (100%) rename scripts/actor_bench/{ => harmonic_results}/top_actors_50_h.txt (100%) rename scripts/actor_bench/{ => harmonic_results}/top_actors_60_h.txt (100%) rename scripts/actor_bench/{ => harmonic_results}/top_actors_70_h.txt (100%) diff --git a/scripts/actor_bench/closeness_results/analysis.py b/scripts/actor_bench/closeness_results/analysis.py new file mode 100755 index 0000000..7da6151 --- /dev/null +++ b/scripts/actor_bench/closeness_results/analysis.py @@ -0,0 +1,28 @@ +import os +import matplotlib.pyplot as plt +import numpy as np +import pandas as pd + +dfs = { + i: pd.read_csv(f"top_actors_{i:02d}_c.txt", sep='\t', usecols=[1], names=["actor"]) + for i in [5] + list(range(10, 71, 10))} +sets = {i: set(df["actor"]) for i, df in dfs.items()} + +diff = [] +for i in sets.keys(): + diff.append([len(sets[i]) - len(sets[i] & sets[j]) for j in sets.keys()]) +diff = np.array(diff, dtype=float) +diff /= len(next(iter(sets.values()))) + +plt.matshow(diff) +for (i, j), z in np.ndenumerate(diff): + plt.gca().text(j, i, f'{z:0.2f}', ha='center', va='center') +plt.gca().set_xticks(np.linspace(0.0, len(sets) - 1, len(sets))) +plt.gca().set_yticks(np.linspace(0.0, len(sets) - 1, len(sets))) +plt.gca().set_xticklabels([f"{i:d}" for i in sets.keys()]) +plt.gca().set_yticklabels([f"{i:d}" for i in sets.keys()]) +plt.ylabel("\nMIN_ACTORS value") +plt.xlabel("\nMIN_ACTORS value") +cb = plt.colorbar() +cb.set_label("\npercentace of difference in results varing MIN_MOVIES") +plt.show() diff --git a/scripts/actor_bench/top_actors_05_c.txt b/scripts/actor_bench/closeness_results/top_actors_05_c.txt similarity index 100% rename from scripts/actor_bench/top_actors_05_c.txt rename to scripts/actor_bench/closeness_results/top_actors_05_c.txt diff --git a/scripts/actor_bench/top_actors_10_c.txt b/scripts/actor_bench/closeness_results/top_actors_10_c.txt similarity index 100% rename from scripts/actor_bench/top_actors_10_c.txt rename to scripts/actor_bench/closeness_results/top_actors_10_c.txt diff --git a/scripts/actor_bench/top_actors_20_c.txt b/scripts/actor_bench/closeness_results/top_actors_20_c.txt similarity index 100% rename from scripts/actor_bench/top_actors_20_c.txt rename to scripts/actor_bench/closeness_results/top_actors_20_c.txt diff --git a/scripts/actor_bench/top_actors_30_c.txt b/scripts/actor_bench/closeness_results/top_actors_30_c.txt similarity index 100% rename from scripts/actor_bench/top_actors_30_c.txt rename to scripts/actor_bench/closeness_results/top_actors_30_c.txt diff --git a/scripts/actor_bench/top_actors_40_c.txt b/scripts/actor_bench/closeness_results/top_actors_40_c.txt similarity index 100% rename from scripts/actor_bench/top_actors_40_c.txt rename to scripts/actor_bench/closeness_results/top_actors_40_c.txt diff --git a/scripts/actor_bench/top_actors_50_c.txt b/scripts/actor_bench/closeness_results/top_actors_50_c.txt similarity index 100% rename from scripts/actor_bench/top_actors_50_c.txt rename to scripts/actor_bench/closeness_results/top_actors_50_c.txt diff --git a/scripts/actor_bench/top_actors_60_c.txt b/scripts/actor_bench/closeness_results/top_actors_60_c.txt similarity index 100% rename from scripts/actor_bench/top_actors_60_c.txt rename to scripts/actor_bench/closeness_results/top_actors_60_c.txt diff --git a/scripts/actor_bench/top_actors_70_c.txt b/scripts/actor_bench/closeness_results/top_actors_70_c.txt similarity index 100% rename from scripts/actor_bench/top_actors_70_c.txt rename to scripts/actor_bench/closeness_results/top_actors_70_c.txt diff --git a/scripts/actor_bench/top_actors_05_h.txt b/scripts/actor_bench/harmonic_results/top_actors_05_h.txt similarity index 100% rename from scripts/actor_bench/top_actors_05_h.txt rename to scripts/actor_bench/harmonic_results/top_actors_05_h.txt diff --git a/scripts/actor_bench/top_actors_10_h.txt b/scripts/actor_bench/harmonic_results/top_actors_10_h.txt similarity index 100% rename from scripts/actor_bench/top_actors_10_h.txt rename to scripts/actor_bench/harmonic_results/top_actors_10_h.txt diff --git a/scripts/actor_bench/top_actors_20_h.txt b/scripts/actor_bench/harmonic_results/top_actors_20_h.txt similarity index 100% rename from scripts/actor_bench/top_actors_20_h.txt rename to scripts/actor_bench/harmonic_results/top_actors_20_h.txt diff --git a/scripts/actor_bench/top_actors_30_h.txt b/scripts/actor_bench/harmonic_results/top_actors_30_h.txt similarity index 100% rename from scripts/actor_bench/top_actors_30_h.txt rename to scripts/actor_bench/harmonic_results/top_actors_30_h.txt diff --git a/scripts/actor_bench/top_actors_40_h.txt b/scripts/actor_bench/harmonic_results/top_actors_40_h.txt similarity index 100% rename from scripts/actor_bench/top_actors_40_h.txt rename to scripts/actor_bench/harmonic_results/top_actors_40_h.txt diff --git a/scripts/actor_bench/top_actors_50_h.txt b/scripts/actor_bench/harmonic_results/top_actors_50_h.txt similarity index 100% rename from scripts/actor_bench/top_actors_50_h.txt rename to scripts/actor_bench/harmonic_results/top_actors_50_h.txt diff --git a/scripts/actor_bench/top_actors_60_h.txt b/scripts/actor_bench/harmonic_results/top_actors_60_h.txt similarity index 100% rename from scripts/actor_bench/top_actors_60_h.txt rename to scripts/actor_bench/harmonic_results/top_actors_60_h.txt diff --git a/scripts/actor_bench/top_actors_70_h.txt b/scripts/actor_bench/harmonic_results/top_actors_70_h.txt similarity index 100% rename from scripts/actor_bench/top_actors_70_h.txt rename to scripts/actor_bench/harmonic_results/top_actors_70_h.txt