Skip to content

Removing hyperparameter(s) from ConfigurationSpace#411

Merged
thijssnelleman merged 31 commits intomainfrom
remove_hyperparameter
Feb 18, 2026
Merged

Removing hyperparameter(s) from ConfigurationSpace#411
thijssnelleman merged 31 commits intomainfrom
remove_hyperparameter

Conversation

@thijssnelleman
Copy link
Copy Markdown
Collaborator

  • Removed Hyperparameter from all clauses regarding forbidden / conditions, leaving all else intact
  • Recalculated the node depth for only the affected nodes in the tree

Comment thread src/ConfigSpace/_condition_tree.py Outdated
Comment thread src/ConfigSpace/_condition_tree.py Outdated
Comment thread src/ConfigSpace/_condition_tree.py Outdated
Comment thread src/ConfigSpace/configuration_space.py
Comment thread test/test_configuration_space.py
@thijssnelleman
Copy link
Copy Markdown
Collaborator Author

@mfeurer @eddiebergman

I updated the structure to now rebuild the DAG: "Now the ConfigurationSpace.remove does all the work, at the end it reset dag by self._dag = Dag() and adds all parameters/conditions/forbiddens as done in ConfigurationSpace.init"

I think after review, with a few minor changes, this can be merged

@thijssnelleman
Copy link
Copy Markdown
Collaborator Author

@mfeurer Reminder for this PR

Comment thread src/ConfigSpace/configuration_space.py Outdated
Comment thread src/ConfigSpace/configuration_space.py
Comment thread src/ConfigSpace/configuration_space.py
Comment thread src/ConfigSpace/configuration_space.py Outdated
Comment thread src/ConfigSpace/configuration_space.py
Comment thread src/ConfigSpace/configuration_space.py
Comment thread pyproject.toml Outdated
Comment thread test/test_configuration_space.py Outdated
Comment thread test/test_configuration_space.py Outdated
Comment thread test/test_configuration_space.py Outdated
thijssnelleman and others added 7 commits February 17, 2026 10:57
Co-authored-by: Matthias Feurer <feurerm@informatik.uni-freiburg.de>
Co-authored-by: Matthias Feurer <feurerm@informatik.uni-freiburg.de>
Co-authored-by: Matthias Feurer <feurerm@informatik.uni-freiburg.de>
Co-authored-by: Matthias Feurer <feurerm@informatik.uni-freiburg.de>
@thijssnelleman thijssnelleman changed the title First edition removing hyperparameter from DAG Removing hyperparameter from DAG Feb 17, 2026
@thijssnelleman thijssnelleman changed the title Removing hyperparameter from DAG Removing hyperparameter(s) from ConfigurationSpace Feb 17, 2026
Comment thread test/test_util.py Outdated
Comment thread test/test_configuration_space.py
Comment thread test/test_configuration_space.py
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request adds a remove() method to ConfigurationSpace that allows hyperparameters to be removed along with their associated conditions and forbidden clauses. The implementation properly handles nested conjunctions by recursively removing hyperparameters and simplifying the condition/forbidden structures as needed.

Changes:

  • Added ConfigurationSpace.remove() method to remove hyperparameters and update conditions/forbiddens accordingly
  • Fixed a bug in test_util.py where the test was not correctly validating generated grid values
  • Various code quality improvements including alphabetical sorting of imports/exports, clearer parenthesization, and more concise boundary checks

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
src/ConfigSpace/configuration_space.py Added new remove() method with recursive logic to handle hyperparameter removal from conditions and forbiddens
test/test_configuration_space.py Comprehensive test coverage for the new remove() method including complex nested conjunctions
test/test_util.py Fixed bug where test was comparing value to itself instead of checking generated vs expected
src/ConfigSpace/util.py Refactored boundary checks to use max/min; incorrectly changed cast() calls to use string literals
src/ConfigSpace/forbidden.py Added trailing commas for consistency; contains debug print statement
src/ConfigSpace/configuration.py Improved readability by adding explicit parentheses around boolean conditions
src/ConfigSpace/_condition_tree.py Moved ConditionLike import from TYPE_CHECKING to runtime imports
src/ConfigSpace/init.py Alphabetically sorted imports
src/ConfigSpace/api/init.py Alphabetically sorted all exports
src/ConfigSpace/hyperparameters/init.py Alphabetically sorted all exports
src/ConfigSpace/c_util.py Alphabetically sorted all exports
src/ConfigSpace/read_and_write/dictionary.py Alphabetically sorted imports and added trailing commas
changelog.md Added entry for the new feature

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/ConfigSpace/configuration_space.py Outdated
Comment thread src/ConfigSpace/configuration_space.py Outdated
Comment thread src/ConfigSpace/configuration_space.py
Comment thread src/ConfigSpace/configuration_space.py Outdated
Comment thread src/ConfigSpace/forbidden.py Outdated
Comment thread src/ConfigSpace/util.py Outdated
Comment thread src/ConfigSpace/util.py Outdated
Comment thread test/test_configuration_space.py Outdated
thijssnelleman and others added 8 commits February 17, 2026 16:56
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@thijssnelleman thijssnelleman merged commit 57b4c67 into main Feb 18, 2026
20 checks passed
@thijssnelleman thijssnelleman deleted the remove_hyperparameter branch February 18, 2026 09:21
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.

4 participants