9
9
10
10
sns .set_style ("ticks" ,{'axes.grid' : True })
11
11
12
- def mean_statistic (sample1 , sample2 , axis = - 1 ):
13
- mean1 = np .mean (sample1 , axis = axis )
14
- mean2 = np .mean (sample2 , axis = axis )
15
- return (mean1 - mean2 ) / mean1
12
+ def median_statistic (sample1 , sample2 , axis = - 1 ):
13
+ median1 = np .median (sample1 , axis = axis )
14
+ median2 = np .median (sample2 , axis = axis )
15
+ return (median2 - median1 ) / median1
16
16
17
17
rng = np .random .default_rng ()
18
18
@@ -33,9 +33,9 @@ def mean_statistic(sample1, sample2, axis=-1):
33
33
samples = []
34
34
35
35
header_flag = True
36
- n = ceil (len (json_obj1 ["outputs" ]) / 2 )
37
- fig , ax = plt .subplots (2 , n , figsize = (5 * n , 6 ), sharey = False )
38
- plt .subplots_adjust (hspace = 0.3 )
36
+ # n = ceil(len(json_obj1["outputs"]) / 2)
37
+ # fig, ax = plt.subplots(2, n, figsize=(5 * n, 6), sharey=False)
38
+ # plt.subplots_adjust(hspace=0.3)
39
39
i = 0
40
40
for test1 , test2 in zip (json_obj1 ["outputs" ], json_obj2 ["outputs" ]):
41
41
if test1 ["name" ] == test2 ["name" ]:
@@ -48,22 +48,27 @@ def mean_statistic(sample1, sample2, axis=-1):
48
48
samples .append (test1 ["series" ])
49
49
50
50
data = (test2 ["series" ], test1 ["series" ])
51
- res = scipy .stats .bootstrap (data , mean_statistic , method = 'basic' , random_state = rng )
51
+ res = scipy .stats .bootstrap (data , median_statistic , method = 'basic' , random_state = rng )
52
52
53
53
mean2 = np .mean (test2 ["series" ])
54
54
mean1 = np .mean (test1 ["series" ])
55
55
56
- if n != 1 :
57
- curr_plot = ax [i // n , i % n ]
58
- else :
59
- curr_plot = ax [i ]
56
+ # if n != 1:
57
+ # curr_plot = ax[i // n, i % n]
58
+ # else:
59
+ # curr_plot = ax[i]
60
60
61
- sns .kdeplot (test2 ["series" ], fill = True , ax = curr_plot , label = 'baseline' )
62
- sns .kdeplot (test1 ["series" ], fill = True , ax = curr_plot , label = 'current' )
63
- curr_plot .axvline (mean2 , label = 'baseline mean' , color = 'k' )
64
- curr_plot .axvline (mean1 , label = 'current mean' , color = 'g' )
65
- curr_plot .legend ()
66
- curr_plot .set_title (f'{ test1 ["name" ]} , { test1 ["executor" ]} ' )
61
+ plt .figure (figsize = (8 , 4 ))
62
+
63
+ sns .kdeplot (test2 ["series" ], fill = True , label = 'baseline' )
64
+ sns .kdeplot (test1 ["series" ], fill = True , label = 'current' )
65
+ plt .axvline (mean2 , label = 'baseline mean' , color = 'k' )
66
+ plt .axvline (mean1 , label = 'current mean' , color = 'g' )
67
+ plt .legend ()
68
+ plt .suptitle (f'{ test1 ["name" ]} , \n { test1 ["executor" ]} ' )
69
+
70
+ plt .tight_layout ()
71
+ plt .savefig (f"{ sys .argv [3 ]} _{ i } .png" )
67
72
68
73
percentage_diff = ((mean2 - mean1 ) / mean2 ) * 100
69
74
@@ -88,7 +93,7 @@ def mean_statistic(sample1, sample2, axis=-1):
88
93
89
94
html_file .close ()
90
95
91
- plt .tight_layout ()
92
- [fig .delaxes (a ) for a in ax .flatten () if not a .has_data ()]
93
- plt .savefig (sys .argv [3 ] + ".png" )
96
+ # plt.tight_layout()
97
+ # [fig.delaxes(a) for a in ax.flatten() if not a.has_data()]
98
+ # plt.savefig(sys.argv[3] + ".png")
94
99
0 commit comments