syne_tune.utils.convert_domain module
- syne_tune.utils.convert_domain.fit_to_regular_grid(x)[source]
Computes the least squares fit of \(a * j + b\) to
x[j], where \(j = 0,\dots, n-1\). Returns the LS estimate ofa,b, and the coefficient of variation \(R^2\).- Parameters:
x (
ndarray) – Strictly increasing sequence- Return type:
Dict[str,float]- Returns:
See above
- syne_tune.utils.convert_domain.convert_choice_domain(domain, name=None)[source]
If the choice domain
domainhas more than 2 numerical values, it is converted tofinrange(),logfinrange(),ordinal(), orlogordinal(). Otherwise,domainis returned as is.The idea is to compute the least squares fit \(a * j + b\) to
x[j], wherexare the sorted values or their logs (if all values are positive). If this fit is very close (judged by coefficient of variation \(R^2\)), we use the equispaced typesfinrangeorlogfinrange, otherwise we useordinalorlogordinal.- Return type:
- syne_tune.utils.convert_domain.convert_linear_to_log_domain(domain, name=None)[source]
- Return type:
- syne_tune.utils.convert_domain.convert_domain(domain, name=None)[source]
If one of the following rules apply,
domainis converted and returned, otherwise it is returned as is.domainis categorical, its values are numerical. This is converted tofinrange(),logfinrange(),ordinal(), orlogordinal(). We fit the values or their logs to the closest regular grid, converting to(log)finrangeif the least squares fit to the grid is good enough, otherwise to(log)ordinal, whereordinalis withkind="nn". Note that the conversion to(log)finrangemay result in slightly different values.domainisfloat` or ``int. This is converted to the same type, but in log scale, if the current scale is linear,loweris positive, and the ratioupper / loweris larger thanUPPER_LOWER_RATIO_THRESHOLD.
- syne_tune.utils.convert_domain.streamline_config_space(config_space, exclude_names=None, verbose=False)[source]
Given a configuration space
config_space, this function returns a new configuration space where some domains may have been replaced by approximately equivalent ones, which are however better suited for Bayesian optimization. Entries with key inexclude_namesare not replaced.See
convert_domain()for what replacement rules may be applied.- Parameters:
config_space (
Dict[str,Any]) – Original configuration spaceexclude_names (
Optional[List[str]]) – Do not convert entries with these keysverbose (
bool) – Log output for replaced domains? Defaults toFalse
- Return type:
Dict[str,Any]- Returns:
Streamlined configuration space