Navigators
Base Navigator
Navigator
Bases: ABC
Base Navigator class for the Odyssey API. This class is an abstract base class (ABC) that defines the basic structure for all Navigator classes in the Odyssey API. It provides methods for generating initial data, display data, log data, and for updating the model and training data.
__init__
__init__(mission: Mission, num_init_design: int = None, init_method: Optional[Union[Navigator]] = None, input_scaling: bool = False, data_standardization: bool = False, display_always_max: bool = False)
Initializes a Navigator object.
Parameters:
-
mission
(Mission
) –The mission object associated with the Navigator.
-
num_init_design
(int
, default:None
) –The number of initial designs. Defaults to None.
-
init_method
(Navigator
, default:None
) –The method used for initialization. See Sampler Navigators for more information. Defaults to None.
-
input_scaling
(bool
, default:False
) –Specifies if input parameters are normalized to the unit cube for model training. Defaults to False.
-
data_standardization
(bool
, default:False
) –Specifies if output parameters are standadized (zero mean and unit variance) for model training. Defaults to False.
-
display_always_max
(bool
, default:False
) –If set to true, minimization problems are logged and displayed as maximization problems. Useful for users who prefer viewing all problems as maximization tasks. Defaults to False.
trajectory
trajectory(*args, **kwargs)
Translates model-specific parameter recommendation to a compatible format (torch.tensor) by calling the abstract _trajectory
method.
probe
probe(input_data: tensor, init: bool, *args, **kwargs) -> Tensor
Probes the functions with the input data and returns the output.
Parameters:
-
input_data
(tensor
) –The input data to probe the functions with.
-
init
(bool
) –A flag indicating whether this is the initial probing.
Returns:
-
Tensor
–torch.Tensor: The output from all functions.
relay
relay(trajectory, observation, *args, **kwargs)
Updates the training data and display data with the new trajectory and observation. Retains standardization and scaling for training data, but reverts to original scale for display data. Logs display data to mission logfile.
Parameters:
-
trajectory
–The new trajectory.
-
observation
–The new observation.
upgrade
upgrade(*args, **kwargs)
Updates the model by calling the model-specific abstract _upgrade
method.
Single Objective Navigators
SingleGP_Navigator
Bases: Navigator
SingleGP_Navigator is a subclass of the Navigator class that uses a single Gaussian Process (GP) model for the mission.
Attributes:
-
requires_init_data
(bool
) –A flag indicating that this navigator requires initial data.
-
acq_function_type
(Type
) –The type of acquisition function to use.
-
acq_function_params
(dict
) –The parameters for the acquisition function.
-
model
(SingleTaskGP
) –The GP model used for the mission.
-
mll
(ExactMarginalLogLikelihood
) –The marginal log likelihood of the model.
-
acq_function
(ExactMarginalLogLikelihood
) –The acquisition function used for the mission.
__init__
__init__(acq_function_type: Type, acq_function_params: dict, *args, **kwargs)
Initializes a SingleGP_Navigator object.
Parameters:
-
acq_function_type
(Type
) –The type of acquisition function to use.
-
acq_function_params
(dict
) –The parameters for the acquisition function.
-
*args
–Variable length argument list.
-
**kwargs
–Arbitrary keyword arguments.
Multi Objective Navigators
qNParEGO_Navigator
Bases: Navigator
__init__
__init__(acq_function_params: dict, *args, **kwargs)
qEHVI_Navigator
Bases: Navigator
__init__
__init__(acq_function_params: dict, *args, **kwargs)
Dragonfly_Navigator
Bases: Navigator
Falcon_Navigator
Bases: Navigator
Sampler Navigators
Sobol_Navigator
Bases: Navigator
Sobol_Navigator is a subclass of the Navigator class that uses Sobol sequence for sampling. The Sobol_Navigator can serve dual purposes: it can be used for initialization and can also function independently as a standalone navigator. The Sobol_Navigator does not necessitate the provision of initial data. As it inherits from the Navigator class, it utilizes the initialization parameters of the Navigator for its own initialization.
Attributes:
-
requires_init_data
(bool
) –A flag, set to False, indicating that this navigator does not require initial data.
-
samples_generated
(int
) –The number of samples generated by the navigator.
__init__
__init__(*args, **kwargs)
Initializes a Sobol_Navigator object.
Parameters:
-
*args
–Variable length argument list.
-
**kwargs
–Arbitrary keyword arguments.
Grid_Navigator
Bases: Navigator
Grid_Navigator is a subclass of the Navigator class that navigates the search space using a grid-based approach. It does not require initial data.
Attributes:
-
requires_init_data
(bool
) –A flag, set to False, indicating that this navigator does not require initial data.
-
iter_value
(int
) –The current iteration value.
-
x
(Tensor
) –The tensor representing the grid.
Warning
As of yet, the Grid_Navigator does not function as a standalone navigator. It is only used for initial sampling.
__init__
__init__(subdivisions: int, *args, **kwargs)
Initializes a Grid_Navigator object.
Parameters:
-
subdivisions
(int
) –The number of equidistant subdivisions of the parameter space for the grid.
-
*args
–Variable length argument list.
-
**kwargs
–Arbitrary keyword arguments.
DataLoader
DataLoader
Bases: Navigator
DataLoader is a subclass of the Navigator class that loads data from log files as initialization. It does not require initial data.
The files being loaded assume that the data is stored in a .csv format with the columns matching with the columns of the attached mission.
The names of these columns must be in the format param_1
, param_2
, ..., param_n
, objective_1
, objective_2
, ..., objective_m
, where n
is the number of parameters and m
is the number of objectives in the mission.
Attributes:
-
requires_init_data
–A flag, set to False, indicating that this navigator does not require initial data.
-
param_columns
–A list of column names for parameters in the data.
-
objective_columns
–A list of column names for objectives in the data.
-
mission_columns
–A list of all column names in the data.
-
data_df
–A DataFrame holding the data loaded from files.
-
iter_value
–An integer iterator for the data_df.
Examples:
Assuming that you have some data, you can load them using the DataLoader as follows:
>>> from odyssey.navigators import DataLoader
...
>>> datafiles = ['missionlogs/MISSION1_NAME.csv', 'missionlogs/MISSION2_NAME.csv']
>>> dl = DataLoader(mission = mission, datafiles = datafiles)
Warning
As of yet, the DataLoader does not function as a standalone navigator. It can only be used for initial sampling.
__init__
__init__(datafiles: list, *args, **kwargs)
Initializes a DataLoader object.
Parameters:
-
datafiles
(list
) –A list of paths to the data files.
-
*args
–Variable length argument list.
-
**kwargs
–Arbitrary keyword arguments.
Raises:
-
AssertionError
–If the number of initial design points is greater than the number of points in the combined datafiles.