Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ jobs:
coverage run -m --source=iohinspector unittest discover
coverage report -m
- name: Upload coverage report
if: ${{ (matrix.python-version == 3.12) && (matrix.os == 'ubuntu-20.04') }}
if: ${{ (matrix.python-version == 3.12) && (matrix.os == 'ubuntu-22.04') }}
env:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
run: |
coverage xml -o cobertura.xml
bash <(curl -Ls https://coverage.codacy.com/get.sh) report
bash <(curl -Ls https://coverage.codacy.com/get.sh) report
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ __pycache__/
*.py[cod]
*$py.class


# C extensions
*.so

Expand Down Expand Up @@ -161,5 +162,5 @@ cython_debug/
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

data
aux/*
data/
aux/
1,024 changes: 1,024 additions & 0 deletions FUNCTION_REFERENCE.md

Large diffs are not rendered by default.

Binary file added example_plots/attractor_network.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example_plots/eaf_differences.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example_plots/eaf_diffs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example_plots/eaf_pareto.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example_plots/eaf_single_objective.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example_plots/ecdf.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example_plots/ecdf_comparison.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example_plots/fixed_budget.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example_plots/fixed_budget_convergence.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example_plots/fixed_target.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example_plots/fixed_target_ert.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example_plots/heatmap_single_run.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example_plots/indicator_over_time.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example_plots/pareto_fronts.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example_plots/robustrank_changes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example_plots/robustrank_over_time.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example_plots/tournament_rankings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
151 changes: 95 additions & 56 deletions examples/MO_Examples.ipynb

Large diffs are not rendered by default.

46 changes: 27 additions & 19 deletions examples/SO_Examples.ipynb

Large diffs are not rendered by default.

Binary file removed image.png
Binary file not shown.
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "iohinspector"
version = "0.0.5"
version = "0.1.0"
authors = [
{ name="Diederick Vermetten", email="d.vermetten@gmail.com" },
{ name="Jacob de Nobel", email="jacobdenobel@gmail.com" },
Expand All @@ -26,7 +26,8 @@ dependencies = [
"pyarrow",
"robustranking",
"seaborn",
"skelo"
"skelo",
"networkx"
]

[project.optional-dependencies]
Expand Down
4 changes: 2 additions & 2 deletions src/iohinspector/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from .align import *
from .data import *
from .manager import *
from .metrics import *
from .indicators import *
from .plot import *
from .metrics import *
from .plots import *
4 changes: 2 additions & 2 deletions src/iohinspector/indicators/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from .final import *

def add_indicator(
df: pl.DataFrame, indicator: Callable, objective_columns: Iterable, **kwargs
df: pl.DataFrame, indicator: Callable, obj_vars: Iterable, **kwargs
) -> pl.DataFrame:
"""Adds an indicator to a Polars DataFrame.

Expand Down Expand Up @@ -39,6 +39,6 @@ def add_indicator(
group of data.
"""
indicator_callable = partial(
indicator, objective_columns=objective_columns, **kwargs
indicator, obj_vars=obj_vars, **kwargs
)
return df.group_by("data_id").map_groups(indicator_callable)
32 changes: 16 additions & 16 deletions src/iohinspector/indicators/anytime.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ def _r2(weight_vec_set, ideal_point, point_set):


class NonDominated:
def __call__(self, group: pl.DataFrame, objective_columns: Iterable):
objectives = np.array(group[objective_columns])
def __call__(self, group: pl.DataFrame, obj_vars: Iterable):
objectives = np.array(group[obj_vars])
is_efficient = np.ones(objectives.shape[0], dtype=bool)
for i, c in enumerate(objectives[1:]):
if is_efficient[i + 1]:
Expand Down Expand Up @@ -82,20 +82,20 @@ def minimize(self):
return False

def __call__(
self, group: pl.DataFrame, objective_columns: Iterable, evals: Iterable[int]
self, group: pl.DataFrame, obj_vars: Iterable, evals: Iterable[int]
) -> pl.DataFrame:
"""
Args:
group (pl.DataFrame): The DataFrame on which the indicator will be added (should be 1 optimization run only)
objective_columns (Iterable): Which columns are the objectives
obj_vars (Iterable): Which columns are the objectives
evals (Iterable[int]): At which evaluations the operation should be performed.
Note that using more evaluations will make the code slower.

Returns:
pl.DataFrame: a new DataFrame with columns of 'evals' and corresponding IGD+
"""
obj_vals = np.clip(
np.array(group[objective_columns]), None, self.reference_point
np.array(group[obj_vars]), None, self.reference_point
)
evals_dt = group["evaluations"]
hvs = [
Expand All @@ -111,7 +111,7 @@ def __call__(
)
.join_asof(group.sort("evaluations"), on="evaluations", strategy="backward")
.fill_null(np.inf)
.drop(objective_columns)
.drop(obj_vars)
)


Expand Down Expand Up @@ -140,20 +140,20 @@ def minimize(self):
return True

def __call__(
self, group: pl.DataFrame, objective_columns: Iterable, evals: Iterable[int]
self, group: pl.DataFrame, obj_vars: Iterable, evals: Iterable[int]
) -> pl.DataFrame:
"""
Args:
group (pl.DataFrame): The DataFrame on which the indicator will be added (should be 1 optimization run only)
objective_columns (Iterable): Which columns are the objectives
obj_vars (Iterable): Which columns are the objectives
evals (Iterable[int]): At which evaluations the operation should be performed.
Note that using more evaluations will make the code slower.

Returns:
pl.DataFrame: a new DataFrame with columns of 'evals' and corresponding IGD+
"""
obj_vals = np.clip(
np.array(group[objective_columns]), None, self.reference_point
np.array(group[obj_vars]), None, self.reference_point
)
evals_dt = group["evaluations"]
hvs = [
Expand All @@ -172,7 +172,7 @@ def __call__(
)
.join_asof(group.sort("evaluations"), on="evaluations", strategy="backward")
.fill_null(np.inf)
.drop(objective_columns)
.drop(obj_vars)
)


Expand All @@ -195,7 +195,7 @@ def var_name(self):
return "IGD+"

def __call__(
self, group: pl.DataFrame, objective_columns: Iterable, evals: Iterable[int]
self, group: pl.DataFrame, obj_vars: Iterable, evals: Iterable[int]
) -> pl.DataFrame:
"""

Expand All @@ -208,7 +208,7 @@ def __call__(
Returns:
pl.DataFrame: a new DataFrame with columns of 'evals' and corresponding IGD+
"""
obj_vals = np.array(group[objective_columns])
obj_vals = np.array(group[obj_vars])
evals_dt = group["evaluations"]
igds = [
igd_plus(
Expand All @@ -226,7 +226,7 @@ def __call__(
)
.join_asof(group.sort("evaluations"), on="evaluations", strategy="backward")
.fill_null(np.inf)
.drop(objective_columns)
.drop(obj_vars)
)

try:
Expand All @@ -251,7 +251,7 @@ def minimize(self):
return True

def __call__(
self, group: pl.DataFrame, objective_columns: Iterable, evals: Iterable[int]
self, group: pl.DataFrame, obj_vars: Iterable, evals: Iterable[int]
) -> pl.DataFrame:
"""

Expand All @@ -264,7 +264,7 @@ def __call__(
Returns:
pl.DataFrame: a new DataFrame with columns of 'evals' and corresponding IGD+
"""
obj_vals = np.array(group[objective_columns])
obj_vals = np.array(group[obj_vars])
evals_dt = group["evaluations"]
igds = [
_r2(
Expand All @@ -283,7 +283,7 @@ def __call__(
)
.join_asof(group.sort("evaluations"), on="evaluations", strategy="backward")
.fill_null(np.inf)
.drop(objective_columns)
.drop(obj_vars)
)

except ImportError:
Expand Down
4 changes: 2 additions & 2 deletions src/iohinspector/indicators/final.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@


class NonDominated:
def __call__(self, group: pl.DataFrame, objective_columns: Iterable):
objectives = np.array(group[objective_columns])
def __call__(self, group: pl.DataFrame, obj_vars: Iterable):
objectives = np.array(group[obj_vars])
return group.with_columns(
pl.Series(name="final_nondominated", values=is_nondominated(objectives))
)
Loading