tempor.methods.core.params module
Module defining Params classes used for sampling in hyperparameter tuning.
-
class tempor.methods.core.params.Params(name: str, bounds: tuple[Any, Any])[source]
Bases: ABC
Abstract base class for all hyperparameter sampling classes. A helper for describing the hyperparameters for
each estimator.
- Parameters:
- name : str
Hyperparameter name.
- bounds : Tuple[Any, Any]
The bounds (lower, higher) of the hyperparameter.
-
abstract get() → list[Any][source]
Returns the hyperparameter name and properties as a list.
- Returns:
The hyperparameter name and properties as a list.
- Return type:
List[Any]
-
sample(trial: Trial | None =
None) → Any[source]
Sample the hyperparameter. If trial is not None, dispatch to _sample_optuna_trial. Otherwise,
dispatch to _sample_default.
- Parameters:
- trial : Optional[Trial], optional
Trial object, e.g optuna.trial. Defaults to None.
- Returns:
The sampled hyperparameter.
- Return type:
Any
-
class tempor.methods.core.params.CategoricalParams(name: str, choices: list[Any])[source]
Bases: Params
Sample from a categorical distribution.
- Parameters:
- name : str
Hyperparameter name.
- choices : List[Any]
The choices to sample from.
-
get() → list[Any][source]
Returns the hyperparameter name and properties as a list.
- Returns:
The hyperparameter name and properties as a list.
- Return type:
List[Any]
-
class tempor.methods.core.params.FloatParams(name: str, low: float, high: float)[source]
Bases: Params
Sample from a float distribution.
- Parameters:
- name : str
Hyperparameter name.
- low : float
Lower bound.
- high : float
Upper bound.
-
get() → list[Any][source]
Returns the hyperparameter name and properties as a list.
- Returns:
The hyperparameter name and properties as a list.
- Return type:
List[Any]
-
class tempor.methods.core.params.IntegerParams(name: str, low: int, high: int, step: int =
1)[source]
Bases: Params
Sample from an integer distribution.
- Parameters:
- name : str
Hyperparameter name.
- low : int
Lower bound.
- high : int
Upper bound.
- step : int, optional
Step. Defaults to 1.
-
get() → list[Any][source]
Returns the hyperparameter name and properties as a list.
- Returns:
The hyperparameter name and properties as a list.
- Return type:
List[Any]