Normal integer
ConfigSpace.hyperparameters.normal_integer
#
NormalIntegerHyperparameter
dataclass
#
NormalIntegerHyperparameter(
name: str,
mu: Number,
sigma: Number,
lower: Number,
upper: Number,
default_value: Number | None = None,
log: bool = False,
meta: Mapping[Hashable, Any] | None = None,
)
Bases: IntegerHyperparameter
A normally distributed integer hyperparameter.
The 'mu' and 'sigma' parameters define the mean and standard deviation of the
normal distribution. The 'lower' and 'upper' parameters move the distribution
from the [0, 1]
-range and scale it appropriately, but the shape of the
distribution is preserved as if it were in [0, 1]
-range.
Its values are sampled from a normal distribution N(mu, sigma)
.
```python exec="True" result="python" source="material-block" from ConfigSpace import NormalIntegerHyperparameter
n = NormalIntegerHyperparameter('n', mu=150, sigma=20, lower=100, upper=200) print(n)
PARAMETER | DESCRIPTION |
---|---|
name |
Name of the hyperparameter, with which it can be accessed
TYPE:
|
mu |
Mean of the normal distribution
TYPE:
|
sigma |
Standard deviation of the normal distribution
TYPE:
|
lower |
Lower bound of of values from which the hyperparameter represents
TYPE:
|
upper |
Upper bound of of values from which the hyperparameter represents
TYPE:
|
default_value |
The default value of this hyperparameter
TYPE:
|
log |
If
TYPE:
|
meta |
Field for holding meta data provided by the user. Not used by ConfigSpace. |
Source code in src/ConfigSpace/hyperparameters/normal_integer.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
|
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.
sigma
instance-attribute
#
Standard deviation of the normal distribution.
size
class-attribute
instance-attribute
#
Size of the hyperparameter, which is the count of ints between upper
and
lower
, inclusive.
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_float
#
to_float() -> NormalFloatHyperparameter
Convert this hyperparameter to a normal float hyperparameter.
Source code in src/ConfigSpace/hyperparameters/normal_integer.py
to_uniform
#
to_uniform() -> UniformIntegerHyperparameter
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. |