Skip to content

Commit 02302d1

Browse files
committed
improved documentation
1 parent 3d7a009 commit 02302d1

File tree

2 files changed

+548
-320
lines changed

2 files changed

+548
-320
lines changed

MCM/MCM.py

Lines changed: 121 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,71 @@ def compare(
6565
include_legend=True,
6666
show_symetry=True,
6767
):
68+
"""
69+
Generate the MCM
70+
71+
Parameters
72+
----------
73+
74+
df_results : pandas DataFrame, the csv file containing results
75+
output_dir : str, default = './', the output directory for the results
76+
pdf_savename : str, default = None, the name of the saved file into pdf format, if None, will not
77+
be saved into this format
78+
png_savename : str, default = None, the name of the saved file into png format, if None, will not
79+
be saved into this format
80+
csv_savename : str, default = None, the name of the saved file into csv format, if None, will not
81+
be saved into this format
82+
tex_savename : str, default = None, the name of the saved file into tex format, if None, will not
83+
be saved into this format
84+
used_statistic : str, default = 'Score', one can imagine using error, time, memory etc. instead
85+
save_as_json : bool, default = True, whether or not to save the python analysis dict
86+
into a json file format
87+
plot_1v1_comparisons : bool, default = True, whether or not to plot the 1v1 scatter results
88+
order_WinTieLoss : str, default = 'higher', the order on considering a win or a loss
89+
for a given statistics
90+
include_ProbaWinTieLoss : bool, default = False, condition whether or not include
91+
the bayesian test of [1] for a probabilistic win tie loss count
92+
bayesian_rope : float, default = 0.01, the rope used in case include_ProbaWinTieLoss is True
93+
include_pvalue : bool, default = True, condition whether or not include a pvalue stats
94+
pvalue_test : str, default = 'wilcoxon', the statistical test to produce the pvalue stats.
95+
pvalue_correction : str, default = None, which correction to use for the pvalue significant test
96+
pvalue_threshold : float, default = 0.05, threshold for considering a comparison is significant
97+
or not. If pvalue < pvalue_threshhold -> comparison is significant.
98+
use_mean : str, default = 'mean-difference', the mean used to comapre two comparates.
99+
order_stats : str, default = 'average-statistic', the way to order the used_statistic, default
100+
setup orders by average statistic over all datasets
101+
order_better : str, default = 'decreasing', by which order to sort stats, from best to worse
102+
dataset_column : str, default = 'dataset_name', the name of the datasets column in the csv file
103+
precision : int, default = 4, the number of floating numbers after decimal point
104+
load_analysis : bool, default = False, if the analysis json file is already created before, the
105+
use can choose to load it
106+
row_comparates : list of str, default = None, a list of included row comparates, if None, all of
107+
the comparates in the study are placed in the rows.
108+
col_comparates : list of str, default = None, a list of included col comparates, if None, all of
109+
the comparates in the study are placed in the cols.
110+
excluded_row_comparates : list of str, default = None, a list of excluded row comparates,
111+
if None, no comparate in the study is excluded from the rows
112+
excluded_col_comparates : list of str, default = None, a list of excluded col comparates,
113+
if None, no comparate in the study is excluded from the cols
114+
colormap : str, default = 'coolwarm', the colormap used in matplotlib, if set to None,
115+
no color map is used and the heatmap is turned off, no colors will be seen
116+
fig_size : str ot tuple of two int (example : '7,10'), default = 'auto', the height and width of the figure,
117+
if 'auto', use get_fig_size function in utils.py. Note that the fig size values are in
118+
matplotlib units
119+
font_size : int, default = 17, the font size of text
120+
colorbar_orientation : str, default = 'vertical', in which orientation to show the colorbar
121+
either horizontal or vertical
122+
colorbar_value : str, default = 'mean-difference', the values for which the heat map colors
123+
are based on
124+
win_label : str, default = "r>c", the winning label to be set on the MCM
125+
tie_label : str, default = "r=c", the tie label to be set on the MCM
126+
loss_label : str, default = "r<c", the loss label to be set on the MCM
127+
include_legend : bool, default = True, whether or not to show the legend on the MCM
128+
show_symetry : bool, default = True, whether or not to show the symetrical part of the heatmap
129+
130+
131+
"""
132+
68133
if isinstance(df_results, str):
69134
# assuming its a path
70135
try:
@@ -148,33 +213,34 @@ def get_analysis(
148213
Parameters
149214
----------
150215
151-
df_results : pandas DataFrame, the csv file containing results
152-
output_dir : str, default = './', the output directory for the results
153-
used_statistic : str, default = 'Score', one can imagine using error, time, memory etc. instead
154-
save_as_json : bool, default = True, whether or not to save the python analysis dict
155-
into a json file format
156-
plot_1v1_comparisons : bool, default = True, whether or not to plot the 1v1 scatter results
157-
158-
159-
order_WinTieLoss : str, default = 'higher', the order on considering a win or a loss
160-
for a given statistics
161-
includeProbaWinTieLoss : bool, default = False, condition whether or not include
216+
df_results : pandas DataFrame, the csv file containing results
217+
output_dir : str, default = './', the output directory for the results
218+
used_statistic : str, default = 'Score', one can imagine using error, time, memory etc. instead
219+
save_as_json : bool, default = True, whether or not to save the python analysis dict
220+
into a json file format
221+
plot_1v1_comparisons : bool, default = True, whether or not to plot the 1v1 scatter results
222+
order_WinTieLoss : str, default = 'higher', the order on considering a win or a loss
223+
for a given statistics
224+
include_ProbaWinTieLoss : bool, default = False, condition whether or not include
162225
the bayesian test of [1] for a probabilistic win tie loss count
163-
include_pvalue : bool, default = True, condition whether or not include a pvalue stats
164-
pvalue_test : str, default = 'wilcoxon', the statistical test to produce the pvalue stats.
165-
pvalue_correction : str, default = None, which correction to use for the pvalue significant test
166-
pvalue_threshhold : float, default = 0.05, threshold for considering a comparison is significant
167-
or not. If pvalue < pvalue_threshhold -> comparison is significant.
168-
used_mean : str, default = 'mean-difference', the mean used to comapre two comparates.
169-
bayesian_rope : float, default = 0.01, the rope used in case include_ProbaWinTieLoss is True
170-
order_stats : str, default = 'average-statistic', the way to order the used_statistic, default
171-
setup orders by average statistic over all datasets
172-
order_better : str, default = 'decreasing', by which order to sort stats, from best to worse
173-
dataset_column : str, default = 'dataset_name', the name of the datasets column in the csv file
226+
bayesian_rope : float, default = 0.01, the rope used in case include_ProbaWinTieLoss is True
227+
include_pvalue : bool, default = True, condition whether or not include a pvalue stats
228+
pvalue_test : str, default = 'wilcoxon', the statistical test to produce the pvalue stats.
229+
pvalue_correction : str, default = None, which correction to use for the pvalue significant test
230+
pvalue_threshhold : float, default = 0.05, threshold for considering a comparison is significant
231+
or not. If pvalue < pvalue_threshhold -> comparison is significant.
232+
use_mean : str, default = 'mean-difference', the mean used to comapre two comparates.
233+
order_stats : str, default = 'average-statistic', the way to order the used_statistic, default
234+
setup orders by average statistic over all datasets
235+
order_better : str, default = 'decreasing', by which order to sort stats, from best to worse
236+
dataset_column : str, default = 'dataset_name', the name of the datasets column in the csv file
237+
precision : int, default = 4, the number of floating numbers after decimal point
238+
load_analysis : bool, default = False, if the analysis json file is already created before, the
239+
use can choose to load it
174240
175241
Returns
176242
-------
177-
analysis : python dictionary containing all extracted comparisons
243+
analysis : python dictionary containing all extracted comparisons
178244
179245
"""
180246

@@ -304,23 +370,40 @@ def draw(
304370
305371
Parameters
306372
----------
307-
analysis : python dict, default = None, a python dictionary exrtracted using get_analysis function
308-
output_dir : str, default = './', output directory for the results
309-
load_analysis : bool, default = True, whether or not to load the analysis json file
310-
colormap : str, default = 'coolwarm', the colormap used in matplotlib, if set to None,
373+
analysis : python dict, default = None, a python dictionary exrtracted using get_analysis function
374+
output_dir : str, default = './', output directory for the results
375+
pdf_savename : str, default = None, the name of the saved file into pdf format, if None, will not
376+
be saved into this format
377+
png_savename : str, default = None, the name of the saved file into png format, if None, will not
378+
be saved into this format
379+
csv_savename : str, default = None, the name of the saved file into csv format, if None, will not
380+
be saved into this format
381+
tex_savename : str, default = None, the name of the saved file into tex format, if None, will not
382+
be saved into this format
383+
row_comparates : list of str, default = None, a list of included row comparates, if None, all of
384+
the comparates in the study are placed in the rows.
385+
col_comparates : list of str, default = None, a list of included col comparates, if None, all of
386+
the comparates in the study are placed in the cols.
387+
excluded_row_comparates : list of str, default = None, a list of excluded row comparates,
388+
if None, no comparate in the study is excluded from the rows
389+
excluded_col_comparates : list of str, default = None, a list of excluded col comparates,
390+
if None, no comparate in the study is excluded from the cols
391+
precision : int, default = 4, the number of floating numbers after the decimal point
392+
colormap : str, default = 'coolwarm', the colormap used in matplotlib, if set to None,
311393
no color map is used and the heatmap is turned off, no colors will be seen
312-
colorbar_value : str, default = 'mean-difference', the values for which the heat map colors
313-
are based on
314-
fig_size : str ot tuple of two int, default = 'auto', the height and width of the figure,
315-
if 'auto', use get_fig_size function in utils.py
316-
font_size : int, default = 17, the font size of text
317-
pixels_per_clf_hieght : float, default = 3, the number of pixels used per comparate in height
318-
inside each cell of the heatmap
319-
pixels_per_clf_width : float, default = 3.5, the number of pixels used per comparate in width
320-
inside each cell of the heatmap
321-
show_symetry : bool, default = True, whether or not to show the symetrical part of the heatmap
322-
colorbar_orientation : str, default = 'vertical', in which orientation to show the colorbar
394+
fig_size : str ot tuple of two int (example : '7,10'), default = 'auto', the height and width of the figure,
395+
if 'auto', use get_fig_size function in utils.py. Note that the fig size values are in
396+
matplotlib units
397+
font_size : int, default = 17, the font size of text
398+
colorbar_orientation : str, default = 'vertical', in which orientation to show the colorbar
323399
either horizontal or vertical
400+
colorbar_value : str, default = 'mean-difference', the values for which the heat map colors
401+
are based on
402+
win_label : str, default = "r>c", the winning label to be set on the MCM
403+
tie_label : str, default = "r=c", the tie label to be set on the MCM
404+
loss_label : str, default = "r<c", the loss label to be set on the MCM
405+
show_symetry : bool, default = True, whether or not to show the symetrical part of the heatmap
406+
include_legend : bool, default = True, whether or not to show the legend on the MCM
324407
325408
"""
326409

0 commit comments

Comments
 (0)