ml_grid.util.bayes_utils
Functions
|
Approximates the number of parameter combinations for hyperparameter search. |
Module Contents
- ml_grid.util.bayes_utils.calculate_combinations(parameter_space: Dict[str, Any] | List[Dict[str, Any]], steps: int = 10) int [source]
Approximates the number of parameter combinations for hyperparameter search.
This function supports both a single dictionary or a list of dictionaries for the parameter space. It is useful for estimating the size of a search space, especially for Bayesian optimization where continuous parameters are sampled.
- Parameters:
parameter_space (Union[Dict[str, Any], List[Dict[str, Any]]]) – A single dictionary or a list of dictionaries representing the parameter space. Keys are parameter names, and values can be skopt.space objects (Real, Integer, Categorical) or simple lists.
steps (int, optional) – The granularity for discretizing continuous parameters (Real). Defaults to 10.
- Returns:
The approximate total number of parameter combinations.
- Return type:
- Raises:
ValueError – If parameter_space is not a dict or a list of dicts.