Hyperparameter
ConfigSpace.hyperparameters.hyperparameter
#
NumberT
module-attribute
#
Some number type that represents a single value in value space for a numerical hyperparameter.
FloatHyperparameter
dataclass
#
Bases: NumericalHyperparameter[float, f64]
Base class for float hyperparameters in the configuration space.
ORDERABLE
class-attribute
#
ORDERABLE: bool = False
If the hyperparameter values have an order. This is used for conditionals and forbiddens relying on relationships.
default_value
instance-attribute
#
default_value: ValueT = default_value
The default value of this hyperparameter.
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.
name
instance-attribute
#
Name of the hyperparameter, with which it can be accessed.
size
instance-attribute
#
Size of the hyperparameter. For integer and choice hyperparameters this
is the number of possible values the hyperparameter can take on within the
specified range. For continuous hyperparameters this is usually np.inf
.
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_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. |
Source code in src/ConfigSpace/hyperparameters/hyperparameter.py
Hyperparameter
dataclass
#
Hyperparameter(
name: str,
default_value: ValueT,
vector_dist: Distribution,
transformer: Transformer[DType],
neighborhood: Neighborhood,
size: int | float,
neighborhood_size: (
float
| int
| Callable[[DType | ValueT | None], int | float]
),
value_cast: Callable[[DType], ValueT] | None,
meta: Mapping[Hashable, Any] | None = None,
)
Bases: ABC
, Generic[ValueT, DType]
Base class for all hyperparameters in the configuration space.
Please see the reference page for more.
PARAMETER | DESCRIPTION |
---|---|
name |
Name of the hyperparameter, with which it can be accessed.
TYPE:
|
default_value |
The default value of this hyperparameter.
TYPE:
|
vector_dist |
The distribution of the hyperparameter in vector space.
TYPE:
|
transformer |
The transformer to convert between value and vector space.
TYPE:
|
neighborhood |
The function to sample neighbors from the hyperparameter.
TYPE:
|
size |
Size of the hyperparameter. For integer and choice hyperparameters
this is the number of possible values the hyperparameter can take on
within the specified range. For continuous hyperparameters this is
usually |
neighborhood_size |
The number of neighbors to sample from the hyperparameter. This can be a fixed number or a function that takes the current value and returns the number of neighbors to sample.
TYPE:
|
value_cast |
A function to cast the value to a different type. This is useful for ensuring when removing from a nunmpy array of hyperparameter values, that the type is preserved. |
meta |
Field for holding meta data provided by the user. Not used by the ConfigSpace. |
Source code in src/ConfigSpace/hyperparameters/hyperparameter.py
LEGAL_VALUE_TYPES
class-attribute
#
The types of values that are legal for this hyperparameter. If set to
"all"
any type is legal. Otherwise, a tuple of types can be provided.
ORDERABLE
class-attribute
#
ORDERABLE: bool = False
If the hyperparameter values have an order. This is used for conditionals and forbiddens relying on relationships.
default_value
instance-attribute
#
default_value: ValueT = default_value
The default value of this hyperparameter.
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.
name
instance-attribute
#
Name of the hyperparameter, with which it can be accessed.
size
instance-attribute
#
Size of the hyperparameter. For integer and choice hyperparameters this
is the number of possible values the hyperparameter can take on within the
specified range. For continuous hyperparameters this is usually np.inf
.
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_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. |
Source code in src/ConfigSpace/hyperparameters/hyperparameter.py
IntegerHyperparameter
dataclass
#
Bases: NumericalHyperparameter[int, i64]
Base class for integer hyperparameters in the configuration space.
ORDERABLE
class-attribute
#
ORDERABLE: bool = False
If the hyperparameter values have an order. This is used for conditionals and forbiddens relying on relationships.
default_value
instance-attribute
#
default_value: ValueT = default_value
The default value of this hyperparameter.
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.
name
instance-attribute
#
Name of the hyperparameter, with which it can be accessed.
size
instance-attribute
#
Size of the hyperparameter. For integer and choice hyperparameters this
is the number of possible values the hyperparameter can take on within the
specified range. For continuous hyperparameters this is usually np.inf
.
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_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. |
Source code in src/ConfigSpace/hyperparameters/hyperparameter.py
NumericalHyperparameter
dataclass
#
Bases: Hyperparameter[NumberT, DType]
Base class for numerical hyperparameters in the configuration space.
Should likely not be used directly and instead inherit from
IntegerHyperparameter
or
FloatHyperparameter
.
ORDERABLE
class-attribute
#
ORDERABLE: bool = False
If the hyperparameter values have an order. This is used for conditionals and forbiddens relying on relationships.
default_value
instance-attribute
#
default_value: ValueT = default_value
The default value of this hyperparameter.
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.
name
instance-attribute
#
Name of the hyperparameter, with which it can be accessed.
size
instance-attribute
#
Size of the hyperparameter. For integer and choice hyperparameters this
is the number of possible values the hyperparameter can take on within the
specified range. For continuous hyperparameters this is usually np.inf
.
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_uniform
abstractmethod
#
to_uniform() -> (
UniformFloatHyperparameter
| UniformIntegerHyperparameter
)
Convert the hyperparameter to its uniform equivalent.
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. |