This repository has been archived by the owner on Jun 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
139 lines (120 loc) · 5.02 KB
/
main.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
from helpers.dataframe_beautifier import DataframeBeautifier
from providers.data_acquisition_provider import DataAcquisitionProvider
from providers.non_parametric_tests_provider import NonParametricTestsProvider
from providers.plots_provider import PlotsProvider
print('Comparing....')
print('--------------------------------------------------')
########################################################################################################################
########################################################################################################################
# 1) Set your custom data's absolute path here 'optional'
# DataAcquisitionProvider.set_algorithms_raw_directory(
# r'D:/algorithm-comparator/assets/algorithms'
# )
# Or use a relative path
# DataAcquisitionProvider.set_algorithms_raw_directory(
# r'assets/algorithms'
# )
# 2) Cache your data -Time consuming- 'One time only, when assets/cached_instances is empty'
# DataAcquisitionProvider.cache_algorithms_comparisons()
# 3) Specify The Desired Dimension, Parameter, & Alpha to Test
DIMENSION = 10
PARAMETER = 8
ALPHA = 0.05
# 4) Invoke any method that you wish
########################################################################################################################
########################################################################################################################
# Get Algorithm Comparisons With W/T/L in Footer (DEPRECATED)-----------------------------------------------------------
df = NonParametricTestsProvider.get_algorithms_comparisons_wtl(
dimension=DIMENSION,
parameter=PARAMETER,
)
DataframeBeautifier.print_console_stream(df)
# Get Algorithm Comparisons With W/T/L in Footer------------------------------------------------------------------------
df = NonParametricTestsProvider.get_algorithms_comparisons_wtl_mannwhitneyu(
dimension=DIMENSION,
parameter=PARAMETER,
alpha=ALPHA,
)
DataframeBeautifier.print_console_stream(df)
# Wilcoxon Test---------------------------------------------------------------------------------------------------------
df = NonParametricTestsProvider.wilcoxon_test(
dimension=DIMENSION,
parameter=PARAMETER,
alpha=ALPHA,
)
DataframeBeautifier.print_console_stream(
df,
apply_scientific_notation_to_all_columns=False,
floating_scientific_notation_columns=['P-Value'],
)
# Best Algorithm (DEPRECATED)-------------------------------------------------------------------------------------------
best = NonParametricTestsProvider.estimate_best_algorithm(
dimension=DIMENSION,
parameter=PARAMETER,
)
print(best)
# Best Algorithm--------------------------------------------------------------------------------------------------------
best = NonParametricTestsProvider.get_best_algorithm(
dimension=DIMENSION,
parameter=PARAMETER,
)
print(best)
# Friedman Test---------------------------------------------------------------------------------------------------------
df = NonParametricTestsProvider.friedman_test(
dimension=DIMENSION,
parameter=PARAMETER,
alpha=ALPHA,
).to_frame()
DataframeBeautifier.print_console_stream(
df.T,
apply_scientific_notation_to_all_columns=False,
floating_scientific_notation_columns=['P-Value', 'Statistic'],
transpose=True,
)
# Post Hoc Tests With Pair-wise Comparisons-----------------------------------------------------------------------------
df = NonParametricTestsProvider.get_post_hoc_tests(
dimension=DIMENSION,
parameter=PARAMETER,
alpha=ALPHA,
algorithm_to_compare='GaAPADE',
)
DataframeBeautifier.print_console_stream(df)
# Post Hoc Tests (Compare With Best Algorithm)--------------------------------------------------------------------------
df = NonParametricTestsProvider.get_post_hoc_tests(
dimension=DIMENSION,
parameter=PARAMETER,
alpha=ALPHA,
)
DataframeBeautifier.print_console_stream(df)
# Normality Plotting----------------------------------------------------------------------------------------------------
PlotsProvider.plot_algorithm_normality_histogram(
dimension=DIMENSION,
parameter=PARAMETER,
alpha=ALPHA,
)
PlotsProvider.plot_algorithm_normality_qq(
dimension=DIMENSION,
parameter=PARAMETER,
alpha=ALPHA,
)
# Comparisons Plotting--------------------------------------------------------------------------------------------------
PlotsProvider.plot_algorithm_comparison_bar(
dimension=DIMENSION,
parameter=PARAMETER
)
PlotsProvider.plot_algorithm_comparison_box(
dimension=DIMENSION,
parameter=PARAMETER
)
# Performance Plotting--------------------------------------------------------------------------------------------------
PlotsProvider.plot_algorithm_performance_fluctuation(
parameter=PARAMETER
)
PlotsProvider.plot_algorithm_performance_fluctuation(
parameter=PARAMETER,
normalize=False
)
# Best Algorithm Plotting-----------------------------------------------------------------------------------------------
PlotsProvider.plot_best_algorithms()
print('--------------------------------------------------')
print('Done.')