freneticlib.core.objective
Module Contents
Classes
Objective base class. Don't use. |
|
For the specification to maximize a given feature. |
|
For the specification to minimize a given feature. |
- class freneticlib.core.objective.Objective(feature, per_simulation_aggregator: Callable | str | List | Dict, threshold: float = None, dynamic_threshold_quantile: float = None)[source]
Bases:
abc.ABCObjective base class. Don’t use.
- Parameters:
feature (str) – The feature that should be optimised.
per_simulation_aggregator (Union[Callable, str, List, Dict]) – How to aggregate over a simulation’s records. (see https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.aggregate.html)
threshold (float, optional) – Only consider elements “better” than this. Defaults to None
dynamic_threshold_quantile (float, optional) – If set, specifies which quantile of values should be used for re-calculation of threshold.
- get_best(df: pandas.DataFrame) pandas.Series[source]
Returns the row whose <feature> value is best (i.e. maximal or minimal). :param df: The execution history. :type df: pd.DataFrame
- Returns:
The best row.
- Return type:
(pd.Series)
- abstract recalculate_dynamic_threshold(df: pandas.DataFrame)[source]
Recalculates the dynamic threshold, if it is provided.
- Parameters:
df (pd.DataFrame) – The execution history.
- abstract filter_by_threshold(df: pandas.DataFrame) pandas.DataFrame[source]
If threshold is specified, filters the dataframe to only contain rows where the feature value exceeds the threshold.
- Parameters:
df (pd.DataFrame) – The execution history.
- Returns:
The filtered execution history.
- Return type:
df (pd.DataFrame)
- class freneticlib.core.objective.MaxObjective(*args, **kwargs)[source]
Bases:
ObjectiveFor the specification to maximize a given feature.
See AbstractObject.__init__ for parameters.
- filter_by_threshold(df: pandas.DataFrame) pandas.DataFrame[source]
If threshold is specified, filters the dataframe to only contain rows where self.feature >= self.threshold.
- Parameters:
df (pd.DataFrame) – The execution history.
- Returns:
The filtered execution history.
- Return type:
df (pd.DataFrame)
- class freneticlib.core.objective.MinObjective(*args, **kwargs)[source]
Bases:
ObjectiveFor the specification to minimize a given feature.
Constructor for MinObjective. Forwards arguments to Objective.
- Parameters:
*args – Arguments that are forwarded to super constructor.
**kwargs – KW-arguments that are forwarded to super constructor.
- filter_by_threshold(df: pandas.DataFrame) pandas.DataFrame[source]
If threshold is specified, filters the dataframe to only contain rows where self.feature <= self.threshold.
- Parameters:
df (pd.DataFrame) – The execution history.
- Returns:
The filtered execution history.
- Return type:
df (pd.DataFrame)