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

Possible bug in ablation #203

Open
Michael190502 opened this issue Dec 29, 2024 · 3 comments
Open

Possible bug in ablation #203

Michael190502 opened this issue Dec 29, 2024 · 3 comments
Assignees

Comments

@Michael190502
Copy link

Hi,

I think I found a possible bug in the ablation file.

Firstly I think after the following line

inc_cost, _ = self._model.predict(np.array([incumbent_encode]))
inc_cost = inc_cost[0] is missing (which is there for def_cost). This though only affects the comparison between these two values a few lines later I think.

Secondly the ablation path analysis did not work correctly for me when I had only categorical hyperparameters. I traced the problem to the ablation file where "encode_config" is used instead of "get_array". This resulted, in my case at least, in an encoding normalised to [0,1] instead of the number of the choice of the categorical hyperparameter. This resulted in the predicted performance of the default configuration being equal to the predicted performance of the incumbent.

It worked correctly when I replaced "encode_config" with "get_array".

Please let me know if this is something specific to my setup or if I did something wrong. I will append an image comparing the encoding of "get_array" to "encode_config" for clarity.

image

@mwever
Copy link
Collaborator

mwever commented Jan 3, 2025

Hi @Michael190502 ,

thanks for reporting this issue, we will have a look at it!

@KrissiHub
Copy link
Collaborator

Hi @Michael190502 ,

I am currently looking into the issue, could you provide a minimal code example/snippet so I can recreate the problem?

@Michael190502
Copy link
Author

Michael190502 commented Jan 17, 2025

Hi @KrissiHub,

as I dont have a prepared run at hand I utilized the example for ablation from examples/api/ablation_paths.py to create an example showing the difference. To demonstrate the difference I made the following simple changes:

  • changed the loaded run in line 16 of the examples/api/ablation_paths.py file to "logs/DeepCAVE/digits_sklearn/run_1" to include a categorical variable
  • changed the default value of the activation categorical variable in "logs/DeepCAVE/digits_sklearn/run_1/configspace.json" from logistic to tanh to avoid having the encoding be zero.
  • Added print(default_encode[0], self.default_config.get_array()[0]) after line 123 in deepcave/evaluators/ablation.py to display the difference in encoding

I hope this suffices as an example even if it is not a code snippet.

Afterwards you could replace all encode_config with get_array to see the difference in the computed ablation paths. I included the two improvement plots before and after changing the encoding. (The first one is after)

Image

Image

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

When branches are created from issues, their pull requests are automatically linked.

3 participants