Skip to content

Configuration Space does not allow Updates #412

Description

@LukasFehring

I believe that Configuration Space does not allow for online updates during its utilization. That would be very helpful, for example, in the case of Search Space Shrinking, or online control over optimization algorithms.

Concretely, it would be useful to allow:

  1. Dynamically adapting the bounds of a hyperparameter
  2. Dynamically adapting the distributions of hyperparameters

There might be other dynamic adaptations.

Activity

  1. LukasFehring commented on Sep 26, 2025

    @LukasFehring
    Author

    Example code, that would be useful, but does not work currently

    from ConfigSpace import ConfigurationSpace, UniformFloatHyperparameter
    
    # Create a configuration space
    cs = ConfigurationSpace()
    
    # Add a single hyperparameter, e.g., learning_rate in [1e-4, 1e-1] (log-scaled)
    lr = UniformFloatHyperparameter(
        name="example",
        lower=0,
        upper=1,
    )
    
    cs.add(lr)
    
    # Example: sample one configuration
    configs = cs.sample_configuration(5)
    print("Before Adaptation:", configs)
    
    hyperparameter = cs["example"]
    hyperparameter.upper = 0.3
    configs = cs.sample_configuration(5)
    
    print("After Adaptation:", configs)
    

    Output

    Before Adaptation: [Configuration(values={
      'example': 0.6369527341018,
    }), Configuration(values={
      'example': 0.217673016241,
    }), Configuration(values={
      'example': 0.1592467284161,
    }), Configuration(values={
      'example': 0.4795892828225,
    }), Configuration(values={
      'example': 0.0662292258439,
    })]
    After Adaptation: [Configuration(values={
      'example': 0.7536177555621,
    }), Configuration(values={
      'example': 0.3542359773483,
    }), Configuration(values={
      'example': 0.2964701814732,
    }), Configuration(values={
      'example': 0.9975855718142,
    }), Configuration(values={
      'example': 0.6256529481526,
    })]
    
  2. thijssnelleman commented on Oct 31, 2025

    @thijssnelleman
    Collaborator

    This makes sense to me as a feature, but there could be several implications for this change. Will look into this next month.

  3. LukasFehring commented on Oct 31, 2025

    @LukasFehring
    Author

    I briefly discussed this with @eddiebergman at some point. I remember him saying that it is mainly a cachin issue.

  4. LukasFehring commented on Nov 11, 2025

    @LukasFehring
    Author

    I would also really like to be able to change the type of a Hyperparameter. For example, from Float, to Categorical :) This would be an extreme space of search space shrinking :)

  5. thijssnelleman commented on Nov 18, 2025

    @thijssnelleman
    Collaborator

    We are currently working on the removal of HPs, I will look what is necessary/overlapping with this

  6. changed the title [-]Configuraiton Space does not allow Updates[/-] [+]Configuration Space does not allow Updates[/+] on Nov 18, 2025
  7. thijssnelleman commented on Nov 18, 2025

    @thijssnelleman
    Collaborator

    First PR version; take a look

    #414

  8. LukasFehring commented on Nov 18, 2025

    @LukasFehring
    Author

    Hey, thank you so much for the update. This already looks really cool. Does this also tackle the neighborhoods? https://automl.github.io/ConfigSpace/latest/reference/hyperparameters/#neighborhoods.

    This is a small code block copied from https://github.com/automl/SMAC3/blob/main/smac/acquisition/maximizer/local_search.py. At first glance, I am unsure if this works with the adaptations in PR.

     for i, inc in enumerate(candidates):
                neighborhood_iterators.append(
                    # get_one_exchange_neighbourhood implementational details:
                    # https://github.com/automl/ConfigSpace/blob/05ab3da2a06c084ba920e8e4e3f62f2e87e81442/ConfigSpace/util.pyx#L95
                    # Return all configurations in a one-exchange neighborhood.
                    #
                    #     The method is implemented as defined by:
                    #     Frank Hutter, Holger H. Hoos and Kevin Leyton-Brown
                    #     Sequential Model-Based Optimization for General Algorithm Configuration
                    #     In Proceedings of the conference on Learning and Intelligent
                    #     Optimization(LION 5)
                    get_one_exchange_neighbourhood(inc, seed=self._rng.randint(low=0, high=100000))
                )
                local_search_steps[i] += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions