SAES 1.0.2__tar.gz → 1.0.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {saes-1.0.2 → saes-1.0.3}/PKG-INFO +1 -1
- {saes-1.0.2 → saes-1.0.3}/SAES/latex_generation/latex_skeleton.py +9 -7
- {saes-1.0.2 → saes-1.0.3}/SAES/latex_generation/latex_tables.py +0 -5
- {saes-1.0.2 → saes-1.0.3}/SAES/plots/critical_distance_plot.py +23 -18
- {saes-1.0.2 → saes-1.0.3}/SAES/utils/csv_processor.py +1 -1
- saes-1.0.3/notebooks/multiobjectiveMetrics.csv +6 -0
- saes-1.0.3/notebooks/multiobjective_optimization.ipynb +444 -0
- {saes-1.0.2 → saes-1.0.3}/pyproject.toml +1 -1
- saes-1.0.2/notebooks/multiobjectiveMetrics.csv +0 -8
- saes-1.0.2/notebooks/multiobjective_optimization.ipynb +0 -429
- {saes-1.0.2 → saes-1.0.3}/.github/workflows/pages.yml +0 -0
- {saes-1.0.2 → saes-1.0.3}/.github/workflows/publish.yml +0 -0
- {saes-1.0.2 → saes-1.0.3}/.github/workflows/test.yml +0 -0
- {saes-1.0.2 → saes-1.0.3}/.gitignore +0 -0
- {saes-1.0.2 → saes-1.0.3}/CONTRIBUTING.md +0 -0
- {saes-1.0.2 → saes-1.0.3}/LICENSE +0 -0
- {saes-1.0.2 → saes-1.0.3}/README.md +0 -0
- {saes-1.0.2 → saes-1.0.3}/SAES/.gitignore +0 -0
- {saes-1.0.2 → saes-1.0.3}/SAES/__init__.py +0 -0
- {saes-1.0.2 → saes-1.0.3}/SAES/__main__.py +0 -0
- {saes-1.0.2 → saes-1.0.3}/SAES/latex_generation/__init__.py +0 -0
- {saes-1.0.2 → saes-1.0.3}/SAES/logger.py +0 -0
- {saes-1.0.2 → saes-1.0.3}/SAES/plots/__init__.py +0 -0
- {saes-1.0.2 → saes-1.0.3}/SAES/plots/boxplot.py +0 -0
- {saes-1.0.2 → saes-1.0.3}/SAES/statistical_tests/__init__.py +0 -0
- {saes-1.0.2 → saes-1.0.3}/SAES/statistical_tests/non_parametrical.py +0 -0
- {saes-1.0.2 → saes-1.0.3}/SAES/utils/__init__.py +0 -0
- {saes-1.0.2 → saes-1.0.3}/SAES/utils/statistical_checks.py +0 -0
- {saes-1.0.2 → saes-1.0.3}/docs/API/api.rst +0 -0
- {saes-1.0.2 → saes-1.0.3}/docs/API/boxplot.rst +0 -0
- {saes-1.0.2 → saes-1.0.3}/docs/API/critical.rst +0 -0
- {saes-1.0.2 → saes-1.0.3}/docs/API/latex.rst +0 -0
- {saes-1.0.2 → saes-1.0.3}/docs/API/utils.rst +0 -0
- {saes-1.0.2 → saes-1.0.3}/docs/Makefile +0 -0
- {saes-1.0.2 → saes-1.0.3}/docs/SAES.png +0 -0
- {saes-1.0.2 → saes-1.0.3}/docs/command_line/command_line.rst +0 -0
- {saes-1.0.2 → saes-1.0.3}/docs/conf.py +0 -0
- {saes-1.0.2 → saes-1.0.3}/docs/configure/configuration.rst +0 -0
- {saes-1.0.2 → saes-1.0.3}/docs/configure/data.rst +0 -0
- {saes-1.0.2 → saes-1.0.3}/docs/configure/metrics.rst +0 -0
- {saes-1.0.2 → saes-1.0.3}/docs/index.rst +0 -0
- {saes-1.0.2 → saes-1.0.3}/docs/make.bat +0 -0
- {saes-1.0.2 → saes-1.0.3}/docs/usage/NHV_cd_plot.png +0 -0
- {saes-1.0.2 → saes-1.0.3}/docs/usage/WFG9.png +0 -0
- {saes-1.0.2 → saes-1.0.3}/docs/usage/cd.rst +0 -0
- {saes-1.0.2 → saes-1.0.3}/docs/usage/friedman.png +0 -0
- {saes-1.0.2 → saes-1.0.3}/docs/usage/latex.rst +0 -0
- {saes-1.0.2 → saes-1.0.3}/docs/usage/median.png +0 -0
- {saes-1.0.2 → saes-1.0.3}/docs/usage/plot.rst +0 -0
- {saes-1.0.2 → saes-1.0.3}/docs/usage/usage.rst +0 -0
- {saes-1.0.2 → saes-1.0.3}/docs/usage/wilcoxon.png +0 -0
- {saes-1.0.2 → saes-1.0.3}/docs/usage/wilcoxon_pivot.png +0 -0
- {saes-1.0.2 → saes-1.0.3}/notebooks/SAES_tutorial.ipynb +0 -0
- {saes-1.0.2 → saes-1.0.3}/notebooks/friedman_HV.png +0 -0
- {saes-1.0.2 → saes-1.0.3}/notebooks/swarmIntelligence.csv +0 -0
- {saes-1.0.2 → saes-1.0.3}/tests/latex_generation/__init__.py +0 -0
- {saes-1.0.2 → saes-1.0.3}/tests/latex_generation/test_latex_tables.py +0 -0
- {saes-1.0.2 → saes-1.0.3}/tests/plots/__init__.py +0 -0
- {saes-1.0.2 → saes-1.0.3}/tests/plots/test_boxplot.py +0 -0
- {saes-1.0.2 → saes-1.0.3}/tests/statistical_tests/__init__.py +0 -0
- {saes-1.0.2 → saes-1.0.3}/tests/statistical_tests/test_non_parametrical.py +0 -0
- {saes-1.0.2 → saes-1.0.3}/tests/utils/__init__.py +0 -0
- {saes-1.0.2 → saes-1.0.3}/tests/utils/test_csv_processor.py +0 -0
- {saes-1.0.2 → saes-1.0.3}/tests/utils/test_statistical_checks.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: SAES
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.3
|
|
4
4
|
Summary: Python library designed to analyze and compare the performance of different algorithms across multiple problems using non-parametric statistical tests
|
|
5
5
|
Author-email: "Antonio J. Nebro" <ajnebro@uma.es>, Emilio Rodrigo Carreira Villalta <emiliorodrigo.ecr@gmail.com>
|
|
6
6
|
Maintainer-email: "Antonio J. Nebro" <ajnebro@uma.es>, Emilio Rodrigo Carreira Villalta <emiliorodrigo.ecr@gmail.com>
|
|
@@ -12,12 +12,9 @@ import pandas as pd
|
|
|
12
12
|
import os
|
|
13
13
|
|
|
14
14
|
from SAES.latex_generation.__init__ import TableTypes
|
|
15
|
-
|
|
16
15
|
from SAES.logger import get_logger
|
|
17
|
-
|
|
18
16
|
logger = get_logger(__name__)
|
|
19
17
|
|
|
20
|
-
|
|
21
18
|
def __latex_document_builder(body: str, output_path: str) -> None:
|
|
22
19
|
"""
|
|
23
20
|
Generates a LaTeX document for comparison tables and saves it to the specified path.
|
|
@@ -67,7 +64,6 @@ def __latex_document_builder(body: str, output_path: str) -> None:
|
|
|
67
64
|
with open(output_path + ".tex", "w") as f:
|
|
68
65
|
f.write(latex_doc)
|
|
69
66
|
|
|
70
|
-
|
|
71
67
|
def __create_tables_latex(df_m: pd.DataFrame, metric: str, maximize: bool, output_dir: str) -> None:
|
|
72
68
|
"""
|
|
73
69
|
Generates and saves LaTeX tables based on the provided metric and CSV data.
|
|
@@ -112,7 +108,6 @@ def __create_tables_latex(df_m: pd.DataFrame, metric: str, maximize: bool, outpu
|
|
|
112
108
|
__latex_document_builder(wilcoxon_pivot, os.path.join(output_dir, "wilcoxon_pivot"))
|
|
113
109
|
__latex_document_builder(wilcoxon, os.path.join(output_dir, "wilcoxon"))
|
|
114
110
|
|
|
115
|
-
|
|
116
111
|
def latex_table(data, metrics, metric: str, selected: str, show: bool = False, output_path: str = None,
|
|
117
112
|
sideways: bool = False) -> str:
|
|
118
113
|
"""
|
|
@@ -170,6 +165,11 @@ def latex_table(data, metrics, metric: str, selected: str, show: bool = False, o
|
|
|
170
165
|
|
|
171
166
|
# Process the input data and metrics
|
|
172
167
|
df_m, maximize = process_csv_metrics(data, metrics, metric)
|
|
168
|
+
|
|
169
|
+
if df_m["MetricValue"].nunique() < (len(df_m)/100):
|
|
170
|
+
print("The data is not diverse enough to perform the analysis")
|
|
171
|
+
return None
|
|
172
|
+
|
|
173
173
|
df_agg, df_stats, aggregation_type, _ = process_dataframe_extended(df_m, metric, output_path=output_dir)
|
|
174
174
|
df_og, _ = process_dataframe_basic(df_m, metric, output_path=output_dir)
|
|
175
175
|
|
|
@@ -199,7 +199,6 @@ def latex_table(data, metrics, metric: str, selected: str, show: bool = False, o
|
|
|
199
199
|
logger.info(f"LaTeX {selected} document for metric {metric} saved to {output_dir}")
|
|
200
200
|
return os.path.join(output_dir, selected + ".tex")
|
|
201
201
|
|
|
202
|
-
|
|
203
202
|
def latex(data, metrics, metric: str, output_path: str = None) -> str:
|
|
204
203
|
"""
|
|
205
204
|
Processes the input data and metrics, and generates all the LaTeX reports on disk for a specific metric.
|
|
@@ -242,6 +241,10 @@ def latex(data, metrics, metric: str, output_path: str = None) -> str:
|
|
|
242
241
|
# Process the input data and metrics
|
|
243
242
|
df_m, maximize = process_csv_metrics(data, metrics, metric)
|
|
244
243
|
|
|
244
|
+
if df_m["MetricValue"].nunique() < (len(df_m)/10):
|
|
245
|
+
print("The data is not diverse enough to perform the analysis")
|
|
246
|
+
return None
|
|
247
|
+
|
|
245
248
|
# Create the output directory for the tables
|
|
246
249
|
output_dir = os.path.join(output_path, "outputs", "latex", metric) if output_path else os.path.join(os.getcwd(),
|
|
247
250
|
"outputs",
|
|
@@ -254,7 +257,6 @@ def latex(data, metrics, metric: str, output_path: str = None) -> str:
|
|
|
254
257
|
logger.info(f"LaTeX document for metric {metric} saved to {output_dir}")
|
|
255
258
|
return output_dir
|
|
256
259
|
|
|
257
|
-
|
|
258
260
|
def latex_all_metrics(data, metrics, output_path: str = None) -> str:
|
|
259
261
|
"""
|
|
260
262
|
Processes the input data and metrics, and generates all the LaTeX reports for each metric.
|
|
@@ -2,7 +2,6 @@ from SAES.statistical_tests.non_parametrical import wilcoxon_test
|
|
|
2
2
|
from SAES.statistical_tests.non_parametrical import friedman_test
|
|
3
3
|
import pandas as pd
|
|
4
4
|
|
|
5
|
-
|
|
6
5
|
def median_table(title: str, df_og: pd.DataFrame, df1: pd.DataFrame, df2: pd.DataFrame, metric: str,
|
|
7
6
|
sideways: bool = False) -> str:
|
|
8
7
|
"""
|
|
@@ -96,7 +95,6 @@ def median_table(title: str, df_og: pd.DataFrame, df1: pd.DataFrame, df2: pd.Dat
|
|
|
96
95
|
# Return the final LaTeX code for the table
|
|
97
96
|
return latex_doc, df1
|
|
98
97
|
|
|
99
|
-
|
|
100
98
|
def friedman_table(title: str, df_og: pd.DataFrame, df1: pd.DataFrame, df2: pd.DataFrame, maximize: bool, metric: str,
|
|
101
99
|
sideways: bool = False) -> str:
|
|
102
100
|
"""
|
|
@@ -227,7 +225,6 @@ def friedman_table(title: str, df_og: pd.DataFrame, df1: pd.DataFrame, df2: pd.D
|
|
|
227
225
|
# Return the final LaTeX code for the table
|
|
228
226
|
return latex_doc, df_friedman
|
|
229
227
|
|
|
230
|
-
|
|
231
228
|
def __add_friedman_results(df_agg: pd.DataFrame, df_og: pd.DataFrame, friedman_results: dict) -> pd.DataFrame:
|
|
232
229
|
"""
|
|
233
230
|
Adds the results of the Friedman test to the DataFrame containing the algorithms and instances.
|
|
@@ -258,7 +255,6 @@ def __add_friedman_results(df_agg: pd.DataFrame, df_og: pd.DataFrame, friedman_r
|
|
|
258
255
|
# Return the updated DataFrame
|
|
259
256
|
return df
|
|
260
257
|
|
|
261
|
-
|
|
262
258
|
def wilcoxon_table(title: str, df_og: pd.DataFrame, metric: str, sideways: bool = False) -> str:
|
|
263
259
|
"""
|
|
264
260
|
Creates a LaTeX table for Wilcoxon test results between algorithms (each one against each other one in pairs).
|
|
@@ -363,7 +359,6 @@ def wilcoxon_table(title: str, df_og: pd.DataFrame, metric: str, sideways: bool
|
|
|
363
359
|
# Return the final LaTeX code for the table
|
|
364
360
|
return latex_doc, df_wilcoxon_result
|
|
365
361
|
|
|
366
|
-
|
|
367
362
|
def wilcoxon_pivot_table(title: str, df_og: pd.DataFrame, df1: pd.DataFrame, df2: pd.DataFrame, metric: str,
|
|
368
363
|
sideways: bool = False) -> str:
|
|
369
364
|
"""
|
|
@@ -61,7 +61,8 @@ def __CDplot_metric(df_agg: pd.DataFrame, metric: str, output_dir: str, alpha: f
|
|
|
61
61
|
if elements.size > 0:
|
|
62
62
|
sets[i, :] = [avranks[i], avranks[elements[-1]]]
|
|
63
63
|
sets = np.delete(sets, np.where(sets[:, 0] < 0)[0], axis=0)
|
|
64
|
-
|
|
64
|
+
if sets.size == 0:
|
|
65
|
+
return sets
|
|
65
66
|
# group pairs
|
|
66
67
|
group = sets[0, :]
|
|
67
68
|
for i in range(1, sets.shape[0]):
|
|
@@ -204,7 +205,10 @@ def __CDplot_metric(df_agg: pd.DataFrame, metric: str, output_dir: str, alpha: f
|
|
|
204
205
|
|
|
205
206
|
# Get pair of non-significant methods
|
|
206
207
|
nonsig = _join_alg(avranks, num_alg, cd)
|
|
207
|
-
if nonsig.
|
|
208
|
+
if nonsig.size == 0: # No pairs to process
|
|
209
|
+
left_lines = np.array([]) # Initialize as empty array
|
|
210
|
+
right_lines = np.array([]) # Initialize as empty array
|
|
211
|
+
elif nonsig.ndim == 2:
|
|
208
212
|
if nonsig.shape[0] == 2:
|
|
209
213
|
left_lines = np.reshape(nonsig[0, :], (1, 2))
|
|
210
214
|
right_lines = np.reshape(nonsig[1, :], (1, 2))
|
|
@@ -214,27 +218,28 @@ def __CDplot_metric(df_agg: pd.DataFrame, metric: str, output_dir: str, alpha: f
|
|
|
214
218
|
else:
|
|
215
219
|
left_lines = np.reshape(nonsig, (1, nonsig.shape[0]))
|
|
216
220
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
y=stop - (i + 1) * vspace,
|
|
222
|
-
xmin=sleft + lline * (left_lines[i, 0] - lowest - 0.025) / (highest - lowest),
|
|
223
|
-
xmax=sleft + lline * (left_lines[i, 1] - lowest + 0.025) / (highest - lowest),
|
|
224
|
-
linewidth=2,
|
|
225
|
-
)
|
|
226
|
-
|
|
227
|
-
# plot from the rigth
|
|
228
|
-
if nonsig.ndim == 2:
|
|
229
|
-
vspace = 0.5 * (stop - sbottom) / (left_lines.shape[0])
|
|
230
|
-
for i in range(right_lines.shape[0]):
|
|
221
|
+
if nonsig.size > 0:
|
|
222
|
+
# plot from the left
|
|
223
|
+
vspace = 0.5 * (stop - sbottom) / (left_lines.shape[0] + 1)
|
|
224
|
+
for i in range(left_lines.shape[0]):
|
|
231
225
|
ax.hlines(
|
|
232
226
|
y=stop - (i + 1) * vspace,
|
|
233
|
-
xmin=sleft + lline * (
|
|
234
|
-
xmax=sleft + lline * (
|
|
227
|
+
xmin=sleft + lline * (left_lines[i, 0] - lowest - 0.025) / (highest - lowest),
|
|
228
|
+
xmax=sleft + lline * (left_lines[i, 1] - lowest + 0.025) / (highest - lowest),
|
|
235
229
|
linewidth=2,
|
|
236
230
|
)
|
|
237
231
|
|
|
232
|
+
# plot from the rigth
|
|
233
|
+
if nonsig.ndim == 2:
|
|
234
|
+
vspace = 0.5 * (stop - sbottom) / (left_lines.shape[0])
|
|
235
|
+
for i in range(right_lines.shape[0]):
|
|
236
|
+
ax.hlines(
|
|
237
|
+
y=stop - (i + 1) * vspace,
|
|
238
|
+
xmin=sleft + lline * (right_lines[i, 0] - lowest - 0.025) / (highest - lowest),
|
|
239
|
+
xmax=sleft + lline * (right_lines[i, 1] - lowest + 0.025) / (highest - lowest),
|
|
240
|
+
linewidth=2,
|
|
241
|
+
)
|
|
242
|
+
|
|
238
243
|
output_path = os.path.join(output_dir, f"{metric}_cd_plot.png")
|
|
239
244
|
plt.savefig(output_path, bbox_inches="tight")
|
|
240
245
|
|
|
@@ -153,7 +153,7 @@ def process_csv_metrics(data: str | pd.DataFrame, metrics: str | pd.DataFrame, m
|
|
|
153
153
|
try:
|
|
154
154
|
# Retrieve the maximize flag (True/False) for the specified metric
|
|
155
155
|
maximize = df_m[df_m["MetricName"] == metric]["Maximize"].values[0]
|
|
156
|
-
|
|
156
|
+
|
|
157
157
|
# Filter the data DataFrame for the rows matching the specified metric
|
|
158
158
|
df_n = df[df["MetricName"] == metric].reset_index()
|
|
159
159
|
|