Uniform float
ConfigSpace.hyperparameters.uniform_float
#
UniformFloatHyperparameter
dataclass
#
UniformFloatHyperparameter(
name: str,
lower: Number,
upper: Number,
default_value: Number | None = None,
log: bool = False,
meta: Mapping[Hashable, Any] | None = None,
)
Bases: FloatHyperparameter
A uniformly distributed float hyperparameter.
The 'lower' and 'upper' parameters define the range of values from which the hyperparameter represents. The 'log' parameter defines whether the values of the hyperparameter will be sampled on a log-scale.
Its values are sampled from a uniform distribution U(lower, upper)
.
from ConfigSpace import UniformFloatHyperparameter
u = UniformFloatHyperparameter('u', lower=11.3, upper=12.5, log=False)
print(u)
PARAMETER | DESCRIPTION |
---|---|
name |
Name of the hyperparameter, with which it can be accessed
TYPE:
|
lower |
Lower bound of a range of values from which the hyperparameter represents
TYPE:
|
upper |
Upper bound of a range of values from which the hyperparameter represents
TYPE:
|
default_value |
The default value of this hyperparameter. If not specified, the default value is the midpoint of the range
TYPE:
|
log |
If
TYPE:
|
meta |
Field for holding meta data provided by the user. Not used by ConfigSpace. |
Source code in src/ConfigSpace/hyperparameters/uniform_float.py
default_value
instance-attribute
#
default_value: float
The default value of this hyperparameter.
If not specified, the default value is the midpoint of the range.
log
instance-attribute
#
If True
the values of the hyperparameter will be sampled on a log-scale.
lower
instance-attribute
#
Lower bound of a range of values from which the hyperparameter represents.
lower_vectorized
property
#
lower_vectorized: f64
Lower bound of the hyperparameter in vector space.
meta
instance-attribute
#
Field for holding meta data provided by the user. Not used by the ConfigSpace.
size
class-attribute
instance-attribute
#
Size of hyperparameter. It is set to np.inf for continuous hyperparameters.
upper
instance-attribute
#
Upper bound of a range of values from which the hyperparameter represents.
upper_vectorized
property
#
upper_vectorized: f64
Upper bound of the hyperparameter in vector space.
copy
#
copy(**kwargs: Any) -> Self
Create a copy of the hyperparameter with updated attributes.
PARAMETER | DESCRIPTION |
---|---|
**kwargs |
The attributes to update.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Self
|
A copy of the hyperparameter with the updated attributes. |
Source code in src/ConfigSpace/hyperparameters/hyperparameter.py
get_neighbors
#
get_neighbors(
value: f64,
rs: RandomState,
number: int | None = None,
std: float | None = None,
transform: bool = False,
) -> Array[f64]
Deprecated.
Source code in src/ConfigSpace/hyperparameters/hyperparameter.py
get_num_neighbors
#
Get the number of neighbors to sample for a given value.
PARAMETER | DESCRIPTION |
---|---|
value |
The value to get the number of neighbors for. If |
RETURNS | DESCRIPTION |
---|---|
int | float
|
The number of neighbors to sample. |
Source code in src/ConfigSpace/hyperparameters/hyperparameter.py
get_size
#
is_legal
#
is_legal_vector
#
legal_value
#
Check if a value is legal for this hyperparameter.
PARAMETER | DESCRIPTION |
---|---|
value |
The value to check.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
bool | Mask
|
|
Source code in src/ConfigSpace/hyperparameters/hyperparameter.py
legal_vector
#
Check if a vectorized value is legal for this hyperparameter.
PARAMETER | DESCRIPTION |
---|---|
vector |
The vectorized value to check. |
RETURNS | DESCRIPTION |
---|---|
Mask | bool
|
|
Source code in src/ConfigSpace/hyperparameters/hyperparameter.py
neighbors_values
#
neighbors_values(
value: ValueT | DType,
n: int,
*,
std: float | None = None,
seed: RandomState | None = None
) -> Array[DType]
Sample neighbors of a value.
PARAMETER | DESCRIPTION |
---|---|
value |
The value to sample neighbors from. |
n |
The number of unique neighbors to sample. Warning If there are less than
TYPE:
|
std |
The standard deviation of the neighborhood. If Warning Hyperparameter subclasses are under no obligation to use
this if it does not make sense, i.e. for an
TYPE:
|
seed |
The random state to use for sampling. If
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Array[DType]
|
The sampled neighbors in value space. |
Source code in src/ConfigSpace/hyperparameters/hyperparameter.py
neighbors_vectorized
#
neighbors_vectorized(
vector: Number,
n: int,
*,
std: float | None = None,
seed: RandomState | None = None
) -> Array[f64]
Sample neighbors of a vectorized value.
PARAMETER | DESCRIPTION |
---|---|
vector |
The vectorized value to sample neighbors from.
TYPE:
|
n |
The number of unique neighbors to sample. Warning If there are less than
TYPE:
|
std |
The standard deviation of the neighborhood. If Warning Hyperparameter subclasses are under no obligation to use
this if it does not make sense, i.e. for an
TYPE:
|
seed |
The random state to use for sampling. If
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Array[f64]
|
The sampled neighbors in vectorized space. |
Source code in src/ConfigSpace/hyperparameters/hyperparameter.py
pdf
#
Deprecated.
Source code in src/ConfigSpace/hyperparameters/hyperparameter.py
pdf_values
#
Get the probability density of an array of values.
PARAMETER | DESCRIPTION |
---|---|
values |
The values to get the probability density of. |
RETURNS | DESCRIPTION |
---|---|
Array[f64]
|
The probability density of the values. Where values are not legal, the probability density is zero. |
Source code in src/ConfigSpace/hyperparameters/hyperparameter.py
pdf_vector
#
Get the probability density of an array of vectorized values.
PARAMETER | DESCRIPTION |
---|---|
vector |
The vectorized values to get the probability density of. |
RETURNS | DESCRIPTION |
---|---|
Array[f64]
|
The probability density of the vectorized values. Where vectorized values are not legal, the probability density is zero. |
Source code in src/ConfigSpace/hyperparameters/hyperparameter.py
rvs
#
rvs(
size: int | None = None,
*,
random_state: (
Generator | RandomState | int | None
) = None
) -> ValueT | Array[DType]
Sample a value from this hyperparameter, compatbile with scipy.stats.rvs.
PARAMETER | DESCRIPTION |
---|---|
size |
The number of values to sample. If
TYPE:
|
random_state |
The random state to use for sampling. If
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
ValueT | Array[DType]
|
The sampled value or an array of sampled values, depending on |
Source code in src/ConfigSpace/hyperparameters/hyperparameter.py
sample
#
sample(rs: RandomState) -> ValueT
sample_value
#
sample_value(
size: int | None = None,
*,
seed: RandomState | None = None
) -> ValueT | Array[DType]
Sample a value from this hyperparameter.
PARAMETER | DESCRIPTION |
---|---|
size |
The number of values to sample. If
TYPE:
|
seed |
The random state to use for sampling. If
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
ValueT | Array[DType]
|
The sampled value or an array of sampled values, depending on |
Source code in src/ConfigSpace/hyperparameters/hyperparameter.py
sample_vector
#
sample_vector(
size: int | None = None,
*,
seed: RandomState | None = None
) -> f64 | Array[f64]
Sample a vectorized value from this hyperparameter.
PARAMETER | DESCRIPTION |
---|---|
size |
The number of values to sample. If
TYPE:
|
seed |
The random state to use for sampling. If
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
f64 | Array[f64]
|
The sampled vector or an array of sampled vectors, depending on |
Source code in src/ConfigSpace/hyperparameters/hyperparameter.py
to_integer
#
to_integer() -> UniformIntegerHyperparameter
Converts the hyperparameter to a uniformly integer hyperparameter.
This is done by rounding the lower and upper bounds of the float hyperparameter and the default value.
RETURNS | DESCRIPTION |
---|---|
UniformIntegerHyperparameter
|
A uniformly distributed integer hyperparameter. |
Source code in src/ConfigSpace/hyperparameters/uniform_float.py
to_uniform
#
to_uniform() -> UniformFloatHyperparameter
Convert the hyperparameter to its uniform equivalent.
This will remove any distribution associated with it's vectorized representation.
Source code in src/ConfigSpace/hyperparameters/hyperparameter.py
to_value
#
Transform a vectorized value to a value in value space.
PARAMETER | DESCRIPTION |
---|---|
vector |
The vectorized value to transform. |
RETURNS | DESCRIPTION |
---|---|
ValueT | Array[DType]
|
The value in value space. |
Source code in src/ConfigSpace/hyperparameters/hyperparameter.py
to_vector
#
Transform a value to a vectorized value.
PARAMETER | DESCRIPTION |
---|---|
value |
The value to transform.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
f64 | Array[f64]
|
The vectorized value. |