Skip to content

Commit

Permalink
Solve merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
Sarah Krebs committed Jan 17, 2024
2 parents d2f053e + 9b3df78 commit 379233a
Show file tree
Hide file tree
Showing 18 changed files with 142 additions and 48 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

## Bug-Fixes
- Don't convert BOHB runs with status 'running' (consistent with SMAC).
- Fix api examples (#68).
- Reset inputs to fix error when subsequently selecting runs with different configspaces, objectives or budgets (#106).
- Fix errors due to changing inputs before runselection (#64).

# Version 1.1.3
Expand Down
17 changes: 11 additions & 6 deletions deepcave/plugins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ def get_base_url(cls) -> str:
str
Url for the plugin as string.
"""
from deepcave import config
from deepcave.config import Config

return f"http://{config.DASH_ADDRESS}:{config.DASH_PORT}/plugins/{cls.id}"
return f"http://{Config.DASH_ADDRESS}:{Config.DASH_PORT}/plugins/{cls.id}"

@staticmethod
def check_run_compatibility(run: AbstractRun) -> bool:
Expand Down Expand Up @@ -360,11 +360,16 @@ def plugin_input_update(pathname: str, *inputs_list: str) -> List[str]:
# because `run` would be removed.
# Also: We want to keep the current run name.
update_dict(_inputs, self.load_inputs())
# Reset inputs
if "objective_id" in _inputs.keys():
update_dict(_inputs, {"objective_id": {"value": None}})
if "budget_id" in _inputs.keys():
update_dict(_inputs, {"budget_id": {"value": None}})
if "hyperparameter_name_1" in _inputs.keys():
update_dict(_inputs, {"hyperparameter_name_1": {"value": None}})
if "hyperparameter_name_2" in _inputs.keys():
update_dict(_inputs, {"hyperparameter_name_2": {"value": None}})

# TODO: Reset only inputs which are not available in another run.
# E.g. if options from budget in run_2 and run_3 are the same
# take the budget from run_2 if changed to run_3. Otherwise,
# reset budgets.
if _run_id:
selected_run = run_handler.get_run(_run_id)

Expand Down
7 changes: 4 additions & 3 deletions deepcave/plugins/budget/budget_correlation.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
from dash import dcc, html
from scipy import stats

from deepcave import config, notification
from deepcave import notification
from deepcave.config import Config
from deepcave.plugins.dynamic import DynamicPlugin
from deepcave.runs import Status
from deepcave.utils.layout import create_table, get_select_options
Expand Down Expand Up @@ -114,7 +115,7 @@ def get_output_layout(register):
[
dbc.Tab(
dcc.Graph(
id=register("graph", "figure"), style={"height": config.FIGURE_HEIGHT}
id=register("graph", "figure"), style={"height": Config.FIGURE_HEIGHT}
),
label="Graph",
),
Expand Down Expand Up @@ -171,7 +172,7 @@ def load_outputs(run, _, outputs):
layout = go.Layout(
xaxis=dict(title="Budget"),
yaxis=dict(title="Correlation"),
margin=config.FIGURE_MARGIN,
margin=Config.FIGURE_MARGIN,
legend=dict(title="Budgets"),
)

Expand Down
6 changes: 3 additions & 3 deletions deepcave/plugins/hyperparameter/importances.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from dash import dcc, html
from dash.exceptions import PreventUpdate

from deepcave import config
from deepcave.config import Config
from deepcave.evaluators.fanova import fANOVA as GlobalEvaluator
from deepcave.evaluators.lpi import LPI as LocalEvaluator
from deepcave.plugins.static import StaticPlugin
Expand Down Expand Up @@ -200,7 +200,7 @@ def process(run, inputs):

@staticmethod
def get_output_layout(register):
return dcc.Graph(register("graph", "figure"), style={"height": config.FIGURE_HEIGHT})
return dcc.Graph(register("graph", "figure"), style={"height": Config.FIGURE_HEIGHT})

@staticmethod
def load_outputs(run, inputs, outputs):
Expand Down Expand Up @@ -272,7 +272,7 @@ def load_outputs(run, inputs, outputs):
barmode="group",
yaxis_title="Importance",
legend={"title": "Budget"},
margin=config.FIGURE_MARGIN,
margin=Config.FIGURE_MARGIN,
xaxis=dict(tickangle=-45),
)
save_image(figure, "importances.pdf")
Expand Down
10 changes: 7 additions & 3 deletions deepcave/plugins/hyperparameter/pdp.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from dash import dcc, html
from pyPDP.algorithms.pdp import PDP

from deepcave import config
from deepcave.config import Config
from deepcave.evaluators.epm.random_forest_surrogate import RandomForestSurrogate
from deepcave.plugins.static import StaticPlugin
from deepcave.runs import Status
Expand Down Expand Up @@ -145,10 +145,13 @@ def load_dependency_inputs(self, run, previous_inputs, inputs):
objective_value = inputs["objective_id"]["value"]
budget_value = inputs["budget_id"]["value"]
hp1_value = inputs["hyperparameter_name_1"]["value"]
hp2_value = inputs["hyperparameter_name_2"]["value"]

if objective_value is None:
objective_value = objective_ids[0]
if budget_value is None:
budget_value = budget_ids[-1]
if hp1_value is None:
hp1_value = hp_names[0]

return {
Expand All @@ -160,6 +163,7 @@ def load_dependency_inputs(self, run, previous_inputs, inputs):
},
"hyperparameter_name_2": {
"options": get_checklist_options([None] + hp_names),
"value": hp2_value,
},
}

Expand Down Expand Up @@ -230,7 +234,7 @@ def process(run, inputs):

@staticmethod
def get_output_layout(register):
return dcc.Graph(register("graph", "figure"), style={"height": config.FIGURE_HEIGHT})
return dcc.Graph(register("graph", "figure"), style={"height": Config.FIGURE_HEIGHT})

@staticmethod
def load_outputs(run, inputs, outputs):
Expand Down Expand Up @@ -344,7 +348,7 @@ def load_outputs(run, inputs, outputs):
dict(
xaxis=dict(tickvals=x_tickvals, ticktext=x_ticktext, title=hp1_name),
yaxis=dict(tickvals=y_tickvals, ticktext=y_ticktext, title=hp2_name),
margin=config.FIGURE_MARGIN,
margin=Config.FIGURE_MARGIN,
)
)

Expand Down
7 changes: 4 additions & 3 deletions deepcave/plugins/objective/configuration_cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from dash import dcc, html
from dash.exceptions import PreventUpdate

from deepcave import config
from deepcave.config import Config
from deepcave.plugins.dynamic import DynamicPlugin
from deepcave.runs import Status
from deepcave.utils.compression import deserialize, serialize
Expand Down Expand Up @@ -126,6 +126,7 @@ def load_dependency_inputs(self, run, _, inputs):
# Pre-set values
if objective_value is None:
objective_value = objective_ids[0]
if budget_value is None:
budget_value = budget_ids[-1]
else:
budget_value = inputs["budget_id"]["value"]
Expand Down Expand Up @@ -177,7 +178,7 @@ def process(run, inputs):

@staticmethod
def get_output_layout(register):
return (dcc.Graph(register("graph", "figure"), style={"height": config.FIGURE_HEIGHT}),)
return (dcc.Graph(register("graph", "figure"), style={"height": Config.FIGURE_HEIGHT}),)

@staticmethod
def load_outputs(run, inputs, outputs):
Expand Down Expand Up @@ -277,7 +278,7 @@ def load_outputs(run, inputs, outputs):
layout = go.Layout(**layout_kwargs)

figure = go.Figure(data=trace, layout=layout)
figure.update_layout(dict(margin=config.FIGURE_MARGIN))
figure.update_layout(dict(margin=Config.FIGURE_MARGIN))
save_image(figure, "configuration_cube.pdf")

return figure
6 changes: 3 additions & 3 deletions deepcave/plugins/objective/cost_over_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from dash import dcc, html
from dash.exceptions import PreventUpdate

from deepcave import config
from deepcave.config import Config
from deepcave.plugins.dynamic import DynamicPlugin
from deepcave.runs import AbstractRun, check_equality
from deepcave.utils.layout import get_select_options, help_button
Expand Down Expand Up @@ -150,7 +150,7 @@ def process(run, inputs):

@staticmethod
def get_output_layout(register):
return dcc.Graph(register("graph", "figure"), style={"height": config.FIGURE_HEIGHT})
return dcc.Graph(register("graph", "figure"), style={"height": Config.FIGURE_HEIGHT})

@staticmethod
def load_outputs(runs, inputs, outputs):
Expand Down Expand Up @@ -245,7 +245,7 @@ def load_outputs(runs, inputs, outputs):
layout = go.Layout(
xaxis=dict(title=xaxis_label, type=type),
yaxis=dict(title=objective.name),
margin=config.FIGURE_MARGIN,
margin=Config.FIGURE_MARGIN,
)

figure = go.Figure(data=traces, layout=layout)
Expand Down
6 changes: 3 additions & 3 deletions deepcave/plugins/objective/parallel_coordinates.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from dash import dcc, html
from dash.exceptions import PreventUpdate

from deepcave import config
from deepcave.config import Config
from deepcave.constants import VALUE_RANGE
from deepcave.evaluators.fanova import fANOVA
from deepcave.plugins.static import StaticPlugin
Expand Down Expand Up @@ -88,7 +88,7 @@ def get_filter_layout(register):
dbc.Label("Limit Hyperparameters"),
help_button(
"Shows either the n most important hyperparameters (if show "
"importance hyperparameters is true) or the first n selected "
"important hyperparameters is true) or the first n selected "
"hyperparameters."
),
dbc.Input(id=register("n_hps", "value"), type="number"),
Expand Down Expand Up @@ -205,7 +205,7 @@ def process(run, inputs):

@staticmethod
def get_output_layout(register):
return dcc.Graph(register("graph", "figure"), style={"height": config.FIGURE_HEIGHT})
return dcc.Graph(register("graph", "figure"), style={"height": Config.FIGURE_HEIGHT})

@staticmethod
def load_outputs(run, inputs, outputs):
Expand Down
6 changes: 3 additions & 3 deletions deepcave/plugins/objective/pareto_front.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import plotly.graph_objs as go
from dash import dcc, html

from deepcave import config
from deepcave.config import Config
from deepcave.plugins.dynamic import DynamicPlugin
from deepcave.runs import Status, check_equality
from deepcave.utils.layout import get_select_options, help_button
Expand Down Expand Up @@ -206,7 +206,7 @@ def process(run, inputs):

@staticmethod
def get_output_layout(register):
return dcc.Graph(register("graph", "figure"), style={"height": config.FIGURE_HEIGHT})
return dcc.Graph(register("graph", "figure"), style={"height": Config.FIGURE_HEIGHT})

@staticmethod
def load_outputs(runs, inputs, outputs):
Expand Down Expand Up @@ -291,7 +291,7 @@ def load_outputs(runs, inputs, outputs):
layout = go.Layout(
xaxis=dict(title=objective_1.name),
yaxis=dict(title=objective_2.name),
margin=config.FIGURE_MARGIN,
margin=Config.FIGURE_MARGIN,
)
else:
layout = None
Expand Down
4 changes: 2 additions & 2 deletions deepcave/plugins/static.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,12 +295,12 @@ def _get_job_id(self, run_name: str, inputs_key: str) -> str:

@interactive
def __call__(self) -> List[Component]: # type: ignore
from deepcave import config
from deepcave.config import Config

self._setup()

components = [
dcc.Interval(id=self.get_internal_id("update-interval"), interval=config.REFRESH_RATE),
dcc.Interval(id=self.get_internal_id("update-interval"), interval=Config.REFRESH_RATE),
dcc.Store(id=self.get_internal_id("update-interval-output"), data=0),
]
components += super().__call__(True)
Expand Down
8 changes: 4 additions & 4 deletions deepcave/plugins/summary/configurations.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import plotly.graph_objs as go
from dash import dcc, html

from deepcave import config
from deepcave.config import Config
from deepcave.constants import VALUE_RANGE
from deepcave.plugins.dynamic import DynamicPlugin
from deepcave.runs import AbstractRun, Status
Expand Down Expand Up @@ -178,7 +178,7 @@ def get_output_layout(register):
dbc.Tab(
dcc.Graph(
id=register("performance_graph", "figure"),
style={"height": config.FIGURE_HEIGHT},
style={"height": Config.FIGURE_HEIGHT},
),
label="Graph",
),
Expand All @@ -192,7 +192,7 @@ def get_output_layout(register):
dbc.Tab(
dcc.Graph(
id=register("configspace_graph", "figure"),
style={"height": config.FIGURE_HEIGHT},
style={"height": Config.FIGURE_HEIGHT},
),
label="Graph",
),
Expand Down Expand Up @@ -231,7 +231,7 @@ def _get_objective_figure(_, outputs, run):
objective_data.append(trace)

layout_kwargs = {
"margin": config.FIGURE_MARGIN,
"margin": Config.FIGURE_MARGIN,
"xaxis": {"title": "Budget", "domain": [0.05 * len(run.get_objectives()), 1]},
}

Expand Down
8 changes: 4 additions & 4 deletions deepcave/plugins/summary/footprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import plotly.graph_objs as go
from dash import dcc, html

from deepcave import config
from deepcave.config import Config
from deepcave.evaluators.footprint import Footprint as Evaluator
from deepcave.plugins.static import StaticPlugin
from deepcave.utils.layout import get_select_options, help_button
Expand Down Expand Up @@ -173,13 +173,13 @@ def get_output_layout(register):
[
dbc.Tab(
dcc.Graph(
id=register("performance", "figure"), style={"height": config.FIGURE_HEIGHT}
id=register("performance", "figure"), style={"height": Config.FIGURE_HEIGHT}
),
label="Performance",
),
dbc.Tab(
dcc.Graph(
id=register("area", "figure"), style={"height": config.FIGURE_HEIGHT}
id=register("area", "figure"), style={"height": Config.FIGURE_HEIGHT}
),
label="Coverage",
),
Expand Down Expand Up @@ -264,7 +264,7 @@ def load_outputs(run, inputs, outputs):
layout = go.Layout(
xaxis=dict(title=None, tickvals=[]),
yaxis=dict(title=None, tickvals=[]),
margin=config.FIGURE_MARGIN,
margin=Config.FIGURE_MARGIN,
)

performance = go.Figure(data=[performance_data] + traces, layout=layout)
Expand Down
10 changes: 5 additions & 5 deletions deepcave/plugins/summary/overview.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
)
from dash import dcc, html

from deepcave import config
from deepcave.config import Config
from deepcave.plugins.dynamic import DynamicPlugin
from deepcave.plugins.summary.configurations import Configurations
from deepcave.runs.group import Group
Expand Down Expand Up @@ -51,14 +51,14 @@ def get_output_layout(register):
dbc.Tab(
dcc.Graph(
id=register("status_statistics", "figure"),
style={"height": config.FIGURE_HEIGHT},
style={"height": Config.FIGURE_HEIGHT},
),
label="Barplot",
),
dbc.Tab(
dcc.Graph(
id=register("config_statistics", "figure"),
style={"height": config.FIGURE_HEIGHT},
style={"height": Config.FIGURE_HEIGHT},
),
label="Heatmap",
),
Expand Down Expand Up @@ -328,7 +328,7 @@ def load_outputs(run, *_):
barmode="group",
xaxis=dict(title="Status"),
yaxis=dict(title="Number of configurations"),
margin=config.FIGURE_MARGIN,
margin=Config.FIGURE_MARGIN,
)
stats_figure = go.Figure(data=stats_data, layout=stats_layout)
save_image(stats_figure, "status_bar.pdf")
Expand All @@ -337,7 +337,7 @@ def load_outputs(run, *_):
legend={"title": "Status"},
xaxis=dict(title="Budget"),
yaxis=dict(title="Configuration ID"),
margin=config.FIGURE_MARGIN,
margin=Config.FIGURE_MARGIN,
)
config_figure = go.Figure(
data=get_discrete_heatmap(
Expand Down
Loading

0 comments on commit 379233a

Please sign in to comment.