Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/symbolic explanations #101

Merged
merged 32 commits into from
Feb 21, 2024
Merged

Conversation

sarah-segel
Copy link
Collaborator

@sarah-segel sarah-segel commented Jan 3, 2024

Plugins

Enhancements

  • Update author email.
  • Add an exit button that first deletes running jobs and then terminates DeepCave (otherwise jobs such as the symbolic regression would continue running after DeepCave termination).
  • Nicer handling of Keyboard Interrupt (avoid long error message in terminal).
  • Disable debug mode (to avoid error messages being shown directly in the UI, especially upon exit of DeepCave).

Bug-Fixes

  • Fix varying configspace index order in PDP and symbolic explanations.

Others

  • Disabled existing loggers again to suppress redis logs

@helegraf helegraf mentioned this pull request Jan 18, 2024
@sarah-segel sarah-segel requested a review from helegraf February 9, 2024 08:10
Copy link
Contributor

@helegraf helegraf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks nice overall and the tests are working 💪 I have some minor remarks. It would also be nice if you could run the pre-commit hooks so everything is formatted properly and address the errors in the new files (some minor things like missing docstring I think).

Also is it correct that I am getting DEBUG console output without changing any settings?

Furthermore, I am running into some problems running the plugin but maybe I am using it wrong. When I select the smac-pendigits run, the plugin does not seem to produce any explanations.

Server Log

SymbolicExplanations (DEBUG): Button pressed.
SymbolicExplanations (DEBUG): Enqueued SMAC-pendigits-015-0-0 (69666054159540351ed1f6fbf825f2cd).
RandomForestSurrogate (DEBUG): RandomForestSurrogate: Initial Seed = 0
RandomForestSurrogate (DEBUG): RandomForestSurrogate: Final Seed = 248400791
PDP (DEBUG): PDP: Initial Seed = 0
PDP (DEBUG): PDP: Final Seed = 1543538891
ICE (DEBUG): ICE: Initial Seed = True
ICE (DEBUG): ICE: Seed = Use existing
ICE (INFO): Recalculating ICE...
    |   Population Average    |             Best Individual              |
---- ------------------------- ------------------------------------------ ----------
 Gen   Length          Fitness   Length          Fitness      OOB Fitness  Time Left
   0    12.62          181.416       11         0.014005              N/A     17.39s
   1     8.73          20.5379       11         0.014005              N/A     14.85s
   2     7.70          0.39384       10         0.014005              N/A     12.92s
   3     4.63           0.2092       10         0.014005              N/A     11.07s
   4     2.15         0.086137        3        0.0140051              N/A      8.63s
   5     2.02        0.0345978        2        0.0140079              N/A      6.89s
   6     2.04        0.0389469        2        0.0140079              N/A      5.37s
   7     2.03        0.0395785        2        0.0140079              N/A      3.46s
   8     2.05        0.0408348        2        0.0140079              N/A      1.72s
   9     2.03         0.039717        2        0.0140079              N/A      0.00s
SymbolicExplanations (DEBUG): Job 69666054159540351ed1f6fbf825f2cd-48ad708a7a708995d8fdf94b34a2dca3 for run_id 69666054159540351ed1f6fbf825f2cd.
SymbolicExplanations (DEBUG): Job 69666054159540351ed1f6fbf825f2cd-48ad708a7a708995d8fdf94b34a2dca3 cached.
SymbolicExplanations (DEBUG): Job 69666054159540351ed1f6fbf825f2cd-48ad708a7a708995d8fdf94b34a2dca3 deleted.
Bildschirmfoto 2024-02-09 um 11 51 20

@@ -2,7 +2,7 @@
# are usually completed in github actions.

SHELL := /bin/bash
VERSION := 1.1.3
VERSION := 1.2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This says version 1.2, but in the Changelog the change is under Version 1.1.4

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Edited to 1.2 in Changelog.

description = "An interactive framework to visualize and analyze your AutoML process in real-time."
url = "automl.org"
project_urls = {
"Documentation": "https://automl.github.io/DeepCAVE/main",
"Source Code": "https://github.com/automl/deepcave",
}
copyright = f"Copyright {datetime.date.today().strftime('%Y')}, {author}"
version = "1.1.3"
version = "1.2"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as the previous comment about inconsistent versions

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.


This plugin is capable of answering similar questions as the Partial Dependencies plugin, i.e.:

* How does the objective change wrt one or two hyperparameters? For example, does the accuracy
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would just write "with respect to"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed that in all cases of wrt

Symbolic Explanations
====================

This plugin is capable of answering similar questions as the Partial Dependencies plugin, i.e.:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally think an explanation of what symbolic explanations are in the first sentence would be best; so just adding one more sentence before this one.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a sentence in the beginning.

deepcave/cli.py Outdated
@@ -1,5 +1,4 @@
from typing import Any, List

import os
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

os is unsused

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed.

@@ -49,6 +49,9 @@ def PLUGINS(self) -> Dict[str, List["Plugin"]]:
from deepcave.plugins.budget.budget_correlation import BudgetCorrelation
from deepcave.plugins.hyperparameter.importances import Importances
from deepcave.plugins.hyperparameter.pdp import PartialDependencies
from deepcave.plugins.hyperparameter.symbolic_explanations import (
SymbolicExplanations,
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the brackets? :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how they got there, removed :)

try:
# Simplification can fail in some cases. If so, use the unsimplified version.
symb_simpl = sympy.simplify(symb_conv)
except:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a specific exception that could be caught here instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I unfortunately didn't track that and cannot find an example now, thus I just changed it to actually print the exception (so if I should see one at some point, I can edit it).


def convert_symb(symb, n_decimals: int = None, hp_names: list = None) -> sympy.core.expr:
"""
Convert a fitted symbolic regression to a simplified and potentially rounded mathematical expression.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is over 100 characters; however, I am not 100% sure what our desired setting for the linter would be. 100 is admittedly really short.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure either, but I think most parts of the code would be fine with 100. I limited the length here.

return function_set


def convert_symb(symb, n_decimals: int = None, hp_names: list = None) -> sympy.core.expr:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Type of symb?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added.

[
dbc.Label("Parsimony coefficient"),
help_button(
"Penalizes the complexity of the resulting formulas."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a line if higher or lower will mean less complexity

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, added.

@sarah-segel
Copy link
Collaborator Author

Looks nice overall and the tests are working 💪 I have some minor remarks. It would also be nice if you could run the pre-commit hooks so everything is formatted properly and address the errors in the new files (some minor things like missing docstring I think).

Also is it correct that I am getting DEBUG console output without changing any settings?

Furthermore, I am running into some problems running the plugin but maybe I am using it wrong. When I select the smac-pendigits run, the plugin does not seem to produce any explanations.

Server Log

SymbolicExplanations (DEBUG): Button pressed.
SymbolicExplanations (DEBUG): Enqueued SMAC-pendigits-015-0-0 (69666054159540351ed1f6fbf825f2cd).
RandomForestSurrogate (DEBUG): RandomForestSurrogate: Initial Seed = 0
RandomForestSurrogate (DEBUG): RandomForestSurrogate: Final Seed = 248400791
PDP (DEBUG): PDP: Initial Seed = 0
PDP (DEBUG): PDP: Final Seed = 1543538891
ICE (DEBUG): ICE: Initial Seed = True
ICE (DEBUG): ICE: Seed = Use existing
ICE (INFO): Recalculating ICE...
    |   Population Average    |             Best Individual              |
---- ------------------------- ------------------------------------------ ----------
 Gen   Length          Fitness   Length          Fitness      OOB Fitness  Time Left
   0    12.62          181.416       11         0.014005              N/A     17.39s
   1     8.73          20.5379       11         0.014005              N/A     14.85s
   2     7.70          0.39384       10         0.014005              N/A     12.92s
   3     4.63           0.2092       10         0.014005              N/A     11.07s
   4     2.15         0.086137        3        0.0140051              N/A      8.63s
   5     2.02        0.0345978        2        0.0140079              N/A      6.89s
   6     2.04        0.0389469        2        0.0140079              N/A      5.37s
   7     2.03        0.0395785        2        0.0140079              N/A      3.46s
   8     2.05        0.0408348        2        0.0140079              N/A      1.72s
   9     2.03         0.039717        2        0.0140079              N/A      0.00s
SymbolicExplanations (DEBUG): Job 69666054159540351ed1f6fbf825f2cd-48ad708a7a708995d8fdf94b34a2dca3 for run_id 69666054159540351ed1f6fbf825f2cd.
SymbolicExplanations (DEBUG): Job 69666054159540351ed1f6fbf825f2cd-48ad708a7a708995d8fdf94b34a2dca3 cached.
SymbolicExplanations (DEBUG): Job 69666054159540351ed1f6fbf825f2cd-48ad708a7a708995d8fdf94b34a2dca3 deleted.
Bildschirmfoto 2024-02-09 um 11 51 20

Regarding the debug logging, I changed the plugin (and other) specific logging settings in logging.yml to INFO.

For the pre-commit hooks, I edited the files I added similar to the changes in the pre-commit branch.

Regarding the problem with the smac-pendigits run, this seems to be related to the problem I ran into with one of Daphne's runs (#111). I added the example there.

@helegraf would be great if you could re-check if everything is addressed :)

Copy link
Contributor

@alexandertornede alexandertornede left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested some small adaptations that might be nice.

handlers: [console]
disable_existing_loggers: false
disable_existing_loggers: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason for us setting this to true?

@@ -13,7 +13,7 @@ Since configurations are used throughout the application, you might find links a
plugin. This plugin is capable of answering following questions:

* Where is the configuration coming from?
* How are the objective values wrt the budgets?
* How are the objective values with respect to the budgets?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are the ....

@sarah-segel sarah-segel merged commit e6c1f2e into development Feb 21, 2024
2 checks passed
@sarah-segel sarah-segel deleted the feature/symbolic-explanations branch February 21, 2024 08:48
github-actions bot pushed a commit that referenced this pull request Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants