SurrogateModel¶
- class SurrogateModel¶
Bases:
Generic
[_T
]A generic surrogate model class for approximating expensive objective functions.
- Type Parameters:
_T: A type variable that must be a subclass of Trainer. This allows the surrogate model to use any specific trainer implementation for training and evaluation.
Methods
Initializes the surrogate model class.
Converts the surrogate model to an Amplify Poly object.
Trains the surrogate model on the given dataset.
Attributes
- classmethod __class_getitem__(params)¶
- __init__(surrogate_variables: PolyArray, trainer: _T) None ¶
Initializes the surrogate model class.
- Parameters:
surrogate_variables (amplify.PolyArray) – The Amplify SDK variables for the model.
trainer (_T) – The trainer to use for the model.
- classmethod __init_subclass__(*args, **kwargs)¶
This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
- to_poly() Poly ¶
Converts the surrogate model to an Amplify Poly object.
- Returns:
The Amplify Poly representation of the surrogate model.
- Return type:
amplify.Poly
- train(training_data: Dataset) None ¶
Trains the surrogate model on the given dataset.
- Parameters:
training_data (Dataset) – The dataset to train on.
- __dict__ = mappingproxy({'__module__': 'amplify_bbopt.surrogate', '__doc__': 'A generic surrogate model class for approximating expensive objective functions.\n\n Type Parameters:\n _T: A type variable that must be a subclass of `Trainer`. This allows the surrogate model to use any specific trainer implementation for training and evaluation.\n ', '__init__': <function SurrogateModel.__init__>, 'variables': <property object>, 'trainer': <property object>, 'train': <function SurrogateModel.train>, 'to_poly': <function SurrogateModel.to_poly>, '__orig_bases__': (typing.Generic[~_T],), '__dict__': <attribute '__dict__' of 'SurrogateModel' objects>, '__weakref__': <attribute '__weakref__' of 'SurrogateModel' objects>, '__parameters__': (~_T,), '__annotations__': {'_surrogate_variables': 'amplify.PolyArray', '_trainer': '_T'}})¶
- __orig_bases__ = (typing.Generic[~_T],)¶
- __parameters__ = (~_T,)¶
- __slots__ = ()¶
- __weakref__¶
list of weak references to the object (if defined)
- property trainer: _T¶
Returns the trainer used in the model.
- property variables: PolyArray¶
Returns the variables used in the model.