aerosandbox.modeling.surrogate_model
#
Module Contents#
Classes#
A SurrogateModel is effectively a callable; it only has the __call__ method, and all subclasses must explicitly |
- class aerosandbox.modeling.surrogate_model.SurrogateModel[source]#
Bases:
aerosandbox.common.AeroSandboxObject
A SurrogateModel is effectively a callable; it only has the __call__ method, and all subclasses must explicitly overwrite this. The only reason it is not a callable is that you want to be able to save it to disk (via pickling) while also having the capability to save associated data (for example, constants associated with a particular model, or underlying data).
If data is used to generate the SurrogateModel, it should be stored as follows:
The independent variable(s) should be stored as SurrogateModel.x_data
in the general N-dimensional case, x_data should be a dictionary where: keys are variable names and
values are float/array
in the case of a 1-dimensional input (R^1 -> R^1), x-data should be a float/array.
The dependent variable should be stored as SurrogateModel.y_data
The type of this variable should be a float or an np.ndarray.
- Even if you don’t have any real x_data or y_data to add as SurrogateModel.x_data or SurrogateModel.y_data,
it’s recommended (but not required) that you add values here as examples that users can inspect in order to see the data types and array shapes required.
- abstract __call__(x)[source]#
Evaluates the surrogate model at some given input x.
- The input x is of the type:
in the general N-dimensional case, a dictionary where keys are variable names and values are float/array.
in the case of a 1-dimensional input (R^1 -> R^2), a float/array.
- Parameters:
x (Union[int, float, aerosandbox.numpy.ndarray, Dict[str, aerosandbox.numpy.ndarray]]) –
- Return type:
Union[float, aerosandbox.numpy.ndarray]
- input_dimensionality()[source]#
Returns the number of inputs that should be supplied in x, where x is the input to the SurrogateModel.
- Return type:
int