forked from sigsep/sigsep-mus-eval
-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_significance_test.py
63 lines (50 loc) · 1.62 KB
/
create_significance_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import matplotlib as mpl
import math
import numpy as np
from matplotlib import gridspec
import scikit_posthocs as sp
import museval
sns.set()
sns.set_context("notebook")
metrics = ['SDR']
targets = ['vocals', 'drums', 'bass', 'other']
oracles = [
'IBM1', 'IBM2', 'IRM1', 'IRM2', 'MWF'
]
comparisons = museval.MethodsStore()
comparisons.add_sisec18()
agg_df = comparisons.agg_frames_scores()
# Convert to Pandas Dataframes
agg_df['oracle'] = agg_df.method.isin(oracles)
# Get sorting keys (sorted by median of SDR:vocals)
df_sort_by = agg_df[
(agg_df.metric == "SDR") &
(agg_df.target == "vocals")
]
methods_by_sdr = df_sort_by.score.groupby(
df_sort_by.method
).median().sort_values().index.tolist()
f = plt.figure(figsize=(22, 20))
# resort them by median SDR
# Get sorting keys (sorted by median of SDR:vocals score)
df_voc = agg_df[(agg_df.target == 'vocals') & (agg_df.metric == "SAR")]
targets_by_voc_sdr = df_voc.score.groupby(
df_voc.method
).median().sort_values().index.tolist()
# prepare the pairwise statistics
pc_voc = sp.posthoc_conover(df_voc, val_col='score', group_col='method', sort=True)
print(pc_voc)
f = plt.figure(figsize=(10, 10))
# Format: diagonal, non-significant, p<0.001, p<0.01, p<0.05
cmap = ['1', '#ff2626', '#ffffff', '#fcbdbd', '#ff7272']
heatmap_args = {'cmap': cmap, 'linewidths': 0.25, 'linecolor': '0.5',
'clip_on': False, 'square': True, 'cbar_ax_bbox': [0.90, 0.35, 0.04, 0.3]}
sp.sign_plot(pc_voc, **heatmap_args)
f.tight_layout()
f.savefig(
"pairwise_vocals.pdf",
bbox_inches='tight',
)