-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use of linters for catching errors and formatters to fix style
- Loading branch information
Showing
161 changed files
with
3,849 additions
and
3,241 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -112,6 +112,5 @@ dask-worker-space | |
# osx | ||
.DS_Store | ||
|
||
# R | ||
.RData | ||
.Rhistory | ||
# Github codespaces | ||
pythonenv3.8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,17 @@ | ||
# Minimal makefile for Sphinx documentation | ||
# | ||
install: | ||
@python setup.py install | ||
|
||
# You can set these variables from the command line. | ||
SPHINXOPTS = | ||
SPHINXBUILD = sphinx-build | ||
SPHINXPROJ = jMetalPy | ||
SOURCEDIR = docs/source | ||
BUILDDIR = build | ||
clean: | ||
@rm -rf build dist .eggs *.egg-info | ||
@find . -type d -name '.mypy_cache' -exec rm -rf {} + | ||
@find . -type d -name '__pycache__' -exec rm -rf {} + | ||
|
||
# Put it first so that "make" without argument is like "make help". | ||
help: | ||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | ||
black: clean | ||
@isort --profile black jmetal/ examples/ | ||
@black jmetal/ | ||
|
||
.PHONY: help Makefile | ||
lint: | ||
@mypy jmetal/ --show-error-codes | ||
|
||
# "make github" option to build gh-pages | ||
github: | ||
@make html | ||
@cp -a $(BUILDDIR)/html/. docs | ||
@rm -r $(BUILDDIR) | ||
|
||
# Catch-all target: route all unknown targets to Sphinx using the new | ||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). | ||
%: Makefile | ||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | ||
tests: | ||
@python -m unittest discover --quiet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,75 @@ | ||
from jmetal.lab.experiment import generate_boxplot, generate_latex_tables, compute_mean_indicator, compute_wilcoxon | ||
from jmetal.lab.experiment import ( | ||
compute_mean_indicator, | ||
compute_wilcoxon, | ||
generate_boxplot, | ||
generate_latex_tables, | ||
) | ||
from jmetal.lab.statistical_test.bayesian import * | ||
from jmetal.lab.statistical_test.functions import * | ||
from jmetal.lab.visualization import CDplot, plot_posterior | ||
|
||
if __name__ == '__main__': | ||
if __name__ == "__main__": | ||
# Generate Median & IQR tables | ||
generate_latex_tables(filename='QualityIndicatorSummary.csv') | ||
generate_latex_tables(filename="QualityIndicatorSummary.csv") | ||
|
||
# Generate boxplots | ||
generate_boxplot(filename='QualityIndicatorSummary.csv') | ||
generate_boxplot(filename="QualityIndicatorSummary.csv") | ||
|
||
# Wilcoxon | ||
compute_wilcoxon(filename='QualityIndicatorSummary.csv') | ||
compute_wilcoxon(filename="QualityIndicatorSummary.csv") | ||
|
||
# Statistical lab | ||
|
||
avg = compute_mean_indicator(filename='QualityIndicatorSummary.csv', indicator_name='HV') | ||
avg = compute_mean_indicator(filename="QualityIndicatorSummary.csv", indicator_name="HV") | ||
print(avg) | ||
|
||
# Non-parametric test | ||
print('-------- Sign Test --------') | ||
print(sign_test(avg[['NSGAII', 'SMPSO']])) | ||
print('-------- Friedman Test --------') | ||
print("-------- Sign Test --------") | ||
print(sign_test(avg[["NSGAII", "SMPSO"]])) | ||
print("-------- Friedman Test --------") | ||
print(friedman_test(avg)) | ||
print('-------- Friedman Aligned Rank Test --------') | ||
print("-------- Friedman Aligned Rank Test --------") | ||
print(friedman_aligned_rank_test(avg)) | ||
print('-------- Quade Test --------') | ||
print("-------- Quade Test --------") | ||
print(quade_test(avg)) | ||
|
||
# Post-hoc tests | ||
print('-------- Friedman Post-Hoc Test --------') | ||
z, p_val, adj_pval = friedman_ph_test(avg, control=0, apv_procedure='Bonferroni') | ||
print('z values \n', z) | ||
print('p-values \n', p_val) | ||
print('adjusted p-values \n', adj_pval) | ||
print('-------- Friedman Aligned Rank Post-Hoc Test --------') | ||
z, p_val, adj_pval = friedman_aligned_ph_test(avg, apv_procedure='Shaffer') | ||
print('z values \n', z) | ||
print('p-values \n', p_val) | ||
print('adjusted p-values \n', adj_pval) | ||
print('-------- QuadeTest Post-Hoc Test --------') | ||
z, p_val, adj_pval = quade_ph_test(avg, apv_procedure='Holm') | ||
print('z values \n', z) | ||
print('p-values \n', p_val) | ||
print('adjusted p-values \n', adj_pval) | ||
print("-------- Friedman Post-Hoc Test --------") | ||
z, p_val, adj_pval = friedman_ph_test(avg, control=0, apv_procedure="Bonferroni") | ||
print("z values \n", z) | ||
print("p-values \n", p_val) | ||
print("adjusted p-values \n", adj_pval) | ||
print("-------- Friedman Aligned Rank Post-Hoc Test --------") | ||
z, p_val, adj_pval = friedman_aligned_ph_test(avg, apv_procedure="Shaffer") | ||
print("z values \n", z) | ||
print("p-values \n", p_val) | ||
print("adjusted p-values \n", adj_pval) | ||
print("-------- QuadeTest Post-Hoc Test --------") | ||
z, p_val, adj_pval = quade_ph_test(avg, apv_procedure="Holm") | ||
print("z values \n", z) | ||
print("p-values \n", p_val) | ||
print("adjusted p-values \n", adj_pval) | ||
|
||
# Plot critical distance | ||
|
||
CDplot(avg.T, alpha=0.15, higher_is_better=True) | ||
|
||
print('-------- Bayesian Sign Test --------') | ||
bst, DProcess = bayesian_sign_test(avg[['NSGAII', 'SMPSO']], rope_limits=[-0.002, 0.002], | ||
prior_strength=0.5, return_sample=True) | ||
plot_posterior(DProcess, higher_is_better=True, alg_names=['NSGAII', 'SMPSO']) | ||
print("-------- Bayesian Sign Test --------") | ||
bst, DProcess = bayesian_sign_test( | ||
avg[["NSGAII", "SMPSO"]], rope_limits=[-0.002, 0.002], prior_strength=0.5, return_sample=True | ||
) | ||
plot_posterior(DProcess, higher_is_better=True, alg_names=["NSGAII", "SMPSO"]) | ||
|
||
print('Pr(NSGAII < SMPSO) = %.3f' % bst[0]) | ||
print('Pr(NSGAII ~= SMPSO) = %.3f' % bst[1]) | ||
print('Pr(NSGAII > SMPSO) = %.3f' % bst[2]) | ||
print("Pr(NSGAII < SMPSO) = %.3f" % bst[0]) | ||
print("Pr(NSGAII ~= SMPSO) = %.3f" % bst[1]) | ||
print("Pr(NSGAII > SMPSO) = %.3f" % bst[2]) | ||
|
||
print('-------- Bayesian Signed Rank Test --------') | ||
bst, DProcess = bayesian_signed_rank_test(avg[['NSGAII', 'SMPSO']], rope_limits=[-0.002, 0.002], | ||
prior_strength=0.5, return_sample=True) | ||
plot_posterior(DProcess, higher_is_better=True, alg_names=['NSGAII', 'SMPSO']) | ||
print("-------- Bayesian Signed Rank Test --------") | ||
bst, DProcess = bayesian_signed_rank_test( | ||
avg[["NSGAII", "SMPSO"]], rope_limits=[-0.002, 0.002], prior_strength=0.5, return_sample=True | ||
) | ||
plot_posterior(DProcess, higher_is_better=True, alg_names=["NSGAII", "SMPSO"]) | ||
|
||
print('Pr(NSGAII < SMPSO) = %.3f' % bst[0]) | ||
print('Pr(NSGAII ~= SMPSO) = %.3f' % bst[1]) | ||
print('Pr(NSGAII > SMPSO) = %.3f' % bst[2]) | ||
print("Pr(NSGAII < SMPSO) = %.3f" % bst[0]) | ||
print("Pr(NSGAII ~= SMPSO) = %.3f" % bst[1]) | ||
print("Pr(NSGAII > SMPSO) = %.3f" % bst[2]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,25 @@ | ||
from jmetal.algorithm.multiobjective.gde3 import GDE3 | ||
from jmetal.problem import ZDT1 | ||
from jmetal.util.solution import read_solutions, print_function_values_to_file, print_variables_to_file | ||
from jmetal.util.solution import ( | ||
print_function_values_to_file, | ||
print_variables_to_file, | ||
read_solutions, | ||
) | ||
from jmetal.util.termination_criterion import StoppingByKeyboard | ||
|
||
if __name__ == '__main__': | ||
if __name__ == "__main__": | ||
problem = ZDT1() | ||
problem.reference_front = read_solutions(filename='resources/reference_front/ZDT1.pf') | ||
problem.reference_front = read_solutions(filename="resources/reference_front/ZDT1.pf") | ||
|
||
algorithm = GDE3( | ||
problem=problem, | ||
population_size=100, | ||
cr=0.5, | ||
f=0.5, | ||
termination_criterion=StoppingByKeyboard() | ||
) | ||
algorithm = GDE3(problem=problem, population_size=100, cr=0.5, f=0.5, termination_criterion=StoppingByKeyboard()) | ||
|
||
algorithm.run() | ||
front = algorithm.get_result() | ||
|
||
# Save results to file | ||
print_function_values_to_file(front, 'FUN.' + algorithm.label) | ||
print_variables_to_file(front, 'VAR.'+ algorithm.label) | ||
print_function_values_to_file(front, "FUN." + algorithm.label) | ||
print_variables_to_file(front, "VAR." + algorithm.label) | ||
|
||
print(f'Algorithm: ${algorithm.get_name()}') | ||
print(f'Problem: ${problem.get_name()}') | ||
print(f'Computing time: ${algorithm.total_computing_time}') | ||
print(f"Algorithm: ${algorithm.get_name()}") | ||
print(f"Problem: ${problem.get_name()}") | ||
print(f"Computing time: ${algorithm.total_computing_time}") |
Oops, something went wrong.