campaign#
Campaign class definition
Classes
|
Base class for tracking optimization progress and other metrics over multiple iterations. |
- class obsidian.campaign.campaign.Campaign(X_space: ParamSpace, target: Target | list[Target], constraints: Output_Constraint | list[Output_Constraint] | None = None, optimizer: Optimizer | None = None, designer: ExpDesigner | None = None, objective: Objective | None = None, seed: int | None = None)[source]#
Bases:
object
Base class for tracking optimization progress and other metrics over multiple iterations.
- X_space#
The parameter space for the campaign.
- Type:
- data#
The data collected during the campaign.
- Type:
pd.DataFrame
- designer#
The experimental designer used for experiment design.
- Type:
- iter#
The current iteration number.
- Type:
int
- seed#
The seed for random number generation.
- Type:
int
- Properties:
m_exp (int): The number of observations in campaign.data y (pd.Series): The response data in campaign.data y_names (list): The names of the response data columns f (pd.Series): The transformed response data o (pd.Series): The objective function evaluated on f o_names (list): The names of the objective function columns X (pd.DataFrame): The input features of campaign.data response_max (float | pd.Series): The maximum for each response target (Target | list[Target]): The target(s) for optimization. objective (Objective, optional): The objective of the optimization campaign
- property X: DataFrame#
Feature columns of the training data
- property X_best: DataFrame#
Best performing X values
- property X_space: ParamSpace#
Campaign ParamSpace
- add_data(df: DataFrame)[source]#
Adds data to the campaign.
- Parameters:
Z_i (pd.DataFrame) – The data to be added to the campaign.
- Raises:
KeyError – If all X_names are not in the dataset
KeyError – If all y_names are not in the dataset
- constrain_outputs(constraints: Output_Constraint | list[Output_Constraint] | None) None [source]#
Sets optional output constraints for the campaign.
- property designer: ExpDesigner#
Campaign Experimental Designer
- property f: Series | DataFrame#
Experimental response data, in transformed space
- fit()[source]#
Maps Optimizer.fit method
- Raises:
ValueError – If no data has been registered to the campaign
- property m_exp: int#
Number of observations in training data
- property o: Series | DataFrame#
Objective function evaluated on f
- property out: Series | DataFrame#
Returns the objective function as appropriate, else the response data
- property response_max: float | Series#
Maximum response data in training set
- save_state() dict [source]#
Saves the state of the Campaign object as a dictionary.
- Returns:
A dictionary containing the saved state of the Campaign object.
- Return type:
dict
- set_X_space(X_space: ParamSpace)[source]#
Sets the campaign ParamSpace
- set_designer(designer: ExpDesigner)[source]#
Sets the campaign experiment designer
- set_target(target: Target | list[Target])[source]#
Sets the experimental target context for the campaign.
- property target#
Campaign experimental target(s)
- property y: Series | DataFrame#
Experimental response data