Skip to content

Commit

Permalink
Sarah Segel: Merge pull request #103 from automl/bugfix/api-examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Github Actions committed Jan 17, 2024
1 parent c7832a6 commit 83237d1
Show file tree
Hide file tree
Showing 166 changed files with 3,475 additions and 68 deletions.
2 changes: 1 addition & 1 deletion development/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: cc40638524a75869b5752aca302f69f8
config: 19058a216288311270b2d5b6ce1eaac4
tags: 645f666f9bcd5a90fca523b33c5a78b7
Binary file modified development/.doctrees/environment.pickle
Binary file not shown.
Binary file not shown.
Binary file modified development/.doctrees/examples/api/index.doctree
Binary file not shown.
Binary file modified development/.doctrees/examples/api/parallel_coordinates.doctree
Binary file not shown.
Binary file added development/.doctrees/examples/api/pdp.doctree
Binary file not shown.
Binary file modified development/.doctrees/examples/api/sg_execution_times.doctree
Binary file not shown.
Binary file modified development/.doctrees/examples/index.doctree
Binary file not shown.
Binary file modified development/.doctrees/sg_execution_times.doctree
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@
Parallel Coordinates
^^^^^^^^^^^^^^^^^^^^
This example shows how to use the plugin parallel coordinates.
This example shows how to use the plugin Parallel Coordinates.
Note that other plugins use the same interfaces and can be used in the same fashion.
"""

from deepcave.plugins.objective.parallel_coordinates import ParallelCoordinates
from deepcave.runs.converters.deepcave import DeepCAVERun
from pathlib import Path


if __name__ == "__main__":
# Instantiate the run
run = DeepCAVERun.from_path("examples/record/logs/DeepCAVE/mlp/run_2")
run = DeepCAVERun.from_path(Path("logs/DeepCAVE/minimal/run_2"))
objective_id = run.get_objective_ids()[0]
budget_id = run.get_budget_ids()[-1]

Expand All @@ -22,12 +23,16 @@
hyperparameter_names=run.configspace.get_hyperparameter_names(),
objective_id=objective_id,
budget_id=budget_id,
show_important_only=True,
show_unsuccessful=False,
hide_hps=False,
n_hps=3,
)
# Note: Filter variables are not considered.
outputs = plugin.generate_outputs(run, inputs)

# Finally, you can load the figure. Here, the filter variables play a role.
# Alternatively: Use the matplotlib output (`load_mpl_outputs`) if available.
figure = plugin.load_outputs(run, inputs, outputs) # plotly.go figure
figure.write_image("examples/api/parallel_coordinates.png", scale=2.)
# figure.show()
# figure.write_image("examples/api/test.png")
43 changes: 43 additions & 0 deletions development/_downloads/99282791bd8a0f766c85ce43b212a6b7/pdp.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n# Partial Dependencies\n\nThis example shows how to use the plugin Partial Dependencies.\nNote that other plugins use the same interfaces and can be used in the same fashion.\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"from deepcave.plugins.hyperparameter.pdp import PartialDependencies\nfrom deepcave.runs.converters.deepcave import DeepCAVERun\nfrom pathlib import Path\n\n\nif __name__ == \"__main__\":\n # Instantiate the run\n run = DeepCAVERun.from_path(Path(\"logs/DeepCAVE/minimal/run_2\"))\n objective_id = run.get_objective_ids()[0]\n budget_id = run.get_budget_ids()[-1]\n\n # Instantiate the plugin\n plugin = PartialDependencies()\n inputs = plugin.generate_inputs(\n hyperparameter_name_1=\"alpha\",\n hyperparameter_name_2=\"beta\",\n objective_id=objective_id,\n budget_id=budget_id,\n show_confidence=False,\n show_ice=True,\n )\n # Note: Filter variables are not considered.\n outputs = plugin.generate_outputs(run, inputs)\n\n # Finally, you can load the figure. Here, the filter variables play a role.\n # Alternatively: Use the matplotlib output (`load_mpl_outputs`) if available.\n figure = plugin.load_outputs(run, inputs, outputs) # plotly.go figure\n figure.write_image(\"examples/api/pdp.png\")\n #figure.show()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.18"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n# Importances\n\nThis example shows how to use the plugin Importances.\nNote that other plugins use the same interfaces and can be used in the same fashion.\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"from deepcave.plugins.hyperparameter.importances import Importances\nfrom deepcave.runs.converters.deepcave import DeepCAVERun\nfrom pathlib import Path\n\n\nif __name__ == \"__main__\":\n # Instantiate the run\n run = DeepCAVERun.from_path(Path(\"logs/DeepCAVE/minimal/run_2\"))\n\n objective_id = run.get_objective_ids()[0]\n budget_ids = run.get_budget_ids()\n\n # Instantiate the plugin\n plugin = Importances()\n inputs = plugin.generate_inputs(\n hyperparameter_names=run.configspace.get_hyperparameter_names(),\n objective_id=objective_id,\n budget_ids=budget_ids,\n method=\"global\",\n n_hps=3,\n n_trees=10\n )\n # Note: Filter variables are not considered.\n outputs = plugin.generate_outputs(run, inputs)\n\n # Finally, you can load the figure. Here, the filter variables play a role.\n # Alternatively: Use the matplotlib output (`load_mpl_outputs`) if available.\n figure = plugin.load_outputs(run, inputs, outputs) # plotly.go figure\n figure.write_image(\"examples/api/importances.png\", scale=2.)\n # figure.show()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.18"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Binary file not shown.
37 changes: 37 additions & 0 deletions development/_downloads/e839af13aa37ae3d835848af3db8e085/pdp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
"""
Partial Dependencies
^^^^^^^^^^^^^^^^^^^^
This example shows how to use the plugin Partial Dependencies.
Note that other plugins use the same interfaces and can be used in the same fashion.
"""

from deepcave.plugins.hyperparameter.pdp import PartialDependencies
from deepcave.runs.converters.deepcave import DeepCAVERun
from pathlib import Path


if __name__ == "__main__":
# Instantiate the run
run = DeepCAVERun.from_path(Path("logs/DeepCAVE/minimal/run_2"))
objective_id = run.get_objective_ids()[0]
budget_id = run.get_budget_ids()[-1]

# Instantiate the plugin
plugin = PartialDependencies()
inputs = plugin.generate_inputs(
hyperparameter_name_1="alpha",
hyperparameter_name_2="beta",
objective_id=objective_id,
budget_id=budget_id,
show_confidence=False,
show_ice=True,
)
# Note: Filter variables are not considered.
outputs = plugin.generate_outputs(run, inputs)

# Finally, you can load the figure. Here, the filter variables play a role.
# Alternatively: Use the matplotlib output (`load_mpl_outputs`) if available.
figure = plugin.load_outputs(run, inputs, outputs) # plotly.go figure
figure.write_image("examples/api/pdp.png")
#figure.show()
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"\n# Parallel Coordinates\n\nThis example shows how to use the plugin parallel coordinates.\nNote that other plugins use the same interfaces and can be used in the same fashion.\n"
"\n# Parallel Coordinates\n\nThis example shows how to use the plugin Parallel Coordinates.\nNote that other plugins use the same interfaces and can be used in the same fashion.\n"
]
},
{
Expand All @@ -15,7 +15,7 @@
},
"outputs": [],
"source": [
"from deepcave.plugins.objective.parallel_coordinates import ParallelCoordinates\nfrom deepcave.runs.converters.deepcave import DeepCAVERun\n\n\nif __name__ == \"__main__\":\n # Instantiate the run\n run = DeepCAVERun.from_path(\"examples/record/logs/DeepCAVE/mlp/run_2\")\n objective_id = run.get_objective_ids()[0]\n budget_id = run.get_budget_ids()[-1]\n\n # Instantiate the plugin\n plugin = ParallelCoordinates()\n inputs = plugin.generate_inputs(\n hyperparameter_names=run.configspace.get_hyperparameter_names(),\n objective_id=objective_id,\n budget_id=budget_id,\n )\n # Note: Filter variables are not considered.\n outputs = plugin.generate_outputs(run, inputs)\n\n # Finally, you can load the figure. Here, the filter variables play a role.\n # Alternatively: Use the matplotlib output (`load_mpl_outputs`) if available.\n figure = plugin.load_outputs(run, inputs, outputs) # plotly.go figure\n # figure.show()\n # figure.write_image(\"examples/api/test.png\")"
"from deepcave.plugins.objective.parallel_coordinates import ParallelCoordinates\nfrom deepcave.runs.converters.deepcave import DeepCAVERun\nfrom pathlib import Path\n\n\nif __name__ == \"__main__\":\n # Instantiate the run\n run = DeepCAVERun.from_path(Path(\"logs/DeepCAVE/minimal/run_2\"))\n objective_id = run.get_objective_ids()[0]\n budget_id = run.get_budget_ids()[-1]\n\n # Instantiate the plugin\n plugin = ParallelCoordinates()\n inputs = plugin.generate_inputs(\n hyperparameter_names=run.configspace.get_hyperparameter_names(),\n objective_id=objective_id,\n budget_id=budget_id,\n show_important_only=True,\n show_unsuccessful=False,\n hide_hps=False,\n n_hps=3,\n )\n # Note: Filter variables are not considered.\n outputs = plugin.generate_outputs(run, inputs)\n\n # Finally, you can load the figure. Here, the filter variables play a role.\n # Alternatively: Use the matplotlib output (`load_mpl_outputs`) if available.\n figure = plugin.load_outputs(run, inputs, outputs) # plotly.go figure\n figure.write_image(\"examples/api/parallel_coordinates.png\", scale=2.)\n # figure.show()"
]
}
],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
"""
Importances
^^^^^^^^^^^^^^^^^^^^
This example shows how to use the plugin Importances.
Note that other plugins use the same interfaces and can be used in the same fashion.
"""

from deepcave.plugins.hyperparameter.importances import Importances
from deepcave.runs.converters.deepcave import DeepCAVERun
from pathlib import Path


if __name__ == "__main__":
# Instantiate the run
run = DeepCAVERun.from_path(Path("logs/DeepCAVE/minimal/run_2"))

objective_id = run.get_objective_ids()[0]
budget_ids = run.get_budget_ids()

# Instantiate the plugin
plugin = Importances()
inputs = plugin.generate_inputs(
hyperparameter_names=run.configspace.get_hyperparameter_names(),
objective_id=objective_id,
budget_ids=budget_ids,
method="global",
n_hps=3,
n_trees=10
)
# Note: Filter variables are not considered.
outputs = plugin.generate_outputs(run, inputs)

# Finally, you can load the figure. Here, the filter variables play a role.
# Alternatively: Use the matplotlib output (`load_mpl_outputs`) if available.
figure = plugin.load_outputs(run, inputs, outputs) # plotly.go figure
figure.write_image("examples/api/importances.png", scale=2.)
# figure.show()
Binary file not shown.
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 development/_images/sphx_glr_pdp_thumb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions development/_modules/deepcave/evaluators/epm/fanova_forest.html
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,16 @@
</i>
</label>
<ul>
<li class="toctree-l3">
<a class="reference internal" href="../../../../examples/api/pdp.html">
Partial Dependencies
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="../../../../examples/api/importances.html">
Importances
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="../../../../examples/api/parallel_coordinates.html">
Parallel Coordinates
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,16 @@
</i>
</label>
<ul>
<li class="toctree-l3">
<a class="reference internal" href="../../../../examples/api/pdp.html">
Partial Dependencies
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="../../../../examples/api/importances.html">
Importances
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="../../../../examples/api/parallel_coordinates.html">
Parallel Coordinates
Expand Down
10 changes: 10 additions & 0 deletions development/_modules/deepcave/evaluators/epm/utils.html
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,16 @@
</i>
</label>
<ul>
<li class="toctree-l3">
<a class="reference internal" href="../../../../examples/api/pdp.html">
Partial Dependencies
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="../../../../examples/api/importances.html">
Importances
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="../../../../examples/api/parallel_coordinates.html">
Parallel Coordinates
Expand Down
10 changes: 10 additions & 0 deletions development/_modules/deepcave/evaluators/fanova.html
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,16 @@
</i>
</label>
<ul>
<li class="toctree-l3">
<a class="reference internal" href="../../../examples/api/pdp.html">
Partial Dependencies
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="../../../examples/api/importances.html">
Importances
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="../../../examples/api/parallel_coordinates.html">
Parallel Coordinates
Expand Down
10 changes: 10 additions & 0 deletions development/_modules/deepcave/layouts.html
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,16 @@
</i>
</label>
<ul>
<li class="toctree-l3">
<a class="reference internal" href="../../examples/api/pdp.html">
Partial Dependencies
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="../../examples/api/importances.html">
Importances
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="../../examples/api/parallel_coordinates.html">
Parallel Coordinates
Expand Down
10 changes: 10 additions & 0 deletions development/_modules/deepcave/layouts/not_found.html
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,16 @@
</i>
</label>
<ul>
<li class="toctree-l3">
<a class="reference internal" href="../../../examples/api/pdp.html">
Partial Dependencies
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="../../../examples/api/importances.html">
Importances
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="../../../examples/api/parallel_coordinates.html">
Parallel Coordinates
Expand Down
10 changes: 10 additions & 0 deletions development/_modules/deepcave/layouts/sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,16 @@
</i>
</label>
<ul>
<li class="toctree-l3">
<a class="reference internal" href="../../../examples/api/pdp.html">
Partial Dependencies
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="../../../examples/api/importances.html">
Importances
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="../../../examples/api/parallel_coordinates.html">
Parallel Coordinates
Expand Down
14 changes: 12 additions & 2 deletions development/_modules/deepcave/plugins.html
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,16 @@
</i>
</label>
<ul>
<li class="toctree-l3">
<a class="reference internal" href="../../examples/api/pdp.html">
Partial Dependencies
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="../../examples/api/importances.html">
Importances
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="../../examples/api/parallel_coordinates.html">
Parallel Coordinates
Expand Down Expand Up @@ -776,9 +786,9 @@ <h1>Source code for deepcave.plugins</h1><div class="highlight"><pre>
<span class="sd"> str</span>
<span class="sd"> Url for the plugin as string.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="kn">from</span> <span class="nn">deepcave</span> <span class="kn">import</span> <span class="n">config</span>
<span class="kn">from</span> <span class="nn">deepcave.config</span> <span class="kn">import</span> <span class="n">Config</span>

<span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;http://</span><span class="si">{</span><span class="n">config</span><span class="o">.</span><span class="n">DASH_ADDRESS</span><span class="si">}</span><span class="s2">:</span><span class="si">{</span><span class="n">config</span><span class="o">.</span><span class="n">DASH_PORT</span><span class="si">}</span><span class="s2">/plugins/</span><span class="si">{</span><span class="bp">cls</span><span class="o">.</span><span class="n">id</span><span class="si">}</span><span class="s2">&quot;</span></div>
<span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;http://</span><span class="si">{</span><span class="n">Config</span><span class="o">.</span><span class="n">DASH_ADDRESS</span><span class="si">}</span><span class="s2">:</span><span class="si">{</span><span class="n">Config</span><span class="o">.</span><span class="n">DASH_PORT</span><span class="si">}</span><span class="s2">/plugins/</span><span class="si">{</span><span class="bp">cls</span><span class="o">.</span><span class="n">id</span><span class="si">}</span><span class="s2">&quot;</span></div>


<div class="viewcode-block" id="Plugin.check_run_compatibility">
Expand Down
10 changes: 10 additions & 0 deletions development/_modules/deepcave/plugins/dynamic.html
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,16 @@
</i>
</label>
<ul>
<li class="toctree-l3">
<a class="reference internal" href="../../../examples/api/pdp.html">
Partial Dependencies
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="../../../examples/api/importances.html">
Importances
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="../../../examples/api/parallel_coordinates.html">
Parallel Coordinates
Expand Down
Loading

0 comments on commit 83237d1

Please sign in to comment.