deephyper.problem.CategoricalHyperparameter#
- class deephyper.problem.CategoricalHyperparameter#
Bases:
Hyperparameter
Methods
allow_greater_less_comparison
check_default
compare
compare_vector
get_max_density
get_neighbors
get_num_neighbors
get_size
has_neighbors
is_legal
Check whether the given value is a legal value for the vector representation of this hyperparameter.
Computes the probability density function of the parameter in the original parameter space (the one specified by the user).
scipy compatibility wrapper for
_sample
, allowing the hyperparameter to be used in sklearn API hyperparameter searchers, eg.sample
Creates a categorical parameter with equal weights for all choices This is used for the uniform configspace when sampling configurations in the local search in PiBO: https://openreview.net/forum?id=MMAeCXIa89
Attributes
choices
default_value
meta
name
normalized_default_value
num_choices
probabilities
weights
- is_legal_vector()#
Check whether the given value is a legal value for the vector representation of this hyperparameter.
- Parameters:
value – the vector value to check
- Returns:
True if the given value is a legal vector value, otherwise False
- Return type:
- pdf()#
Computes the probability density function of the parameter in the original parameter space (the one specified by the user). For each parameter type, there is also a method _pdf which operates on the transformed (and possibly normalized) parameter space. Only legal values return a positive probability density, otherwise zero.
- Parameters:
vector (np.ndarray) – the (N, ) vector of inputs for which the probability density function is to be computed.
- Returns:
Probability density values of the input vector
- Return type:
np.ndarray(N, )
- rvs()#
scipy compatibility wrapper for
_sample
, allowing the hyperparameter to be used in sklearn API hyperparameter searchers, eg. GridSearchCV.
- to_uniform()#
Creates a categorical parameter with equal weights for all choices This is used for the uniform configspace when sampling configurations in the local search in PiBO: https://openreview.net/forum?id=MMAeCXIa89
- Returns:
An identical parameter as the original, except that all weights are uniform.
- Return type: