aerosandbox.modeling.surrogate_model
Classes
SurrogateModel | A SurrogateModel is effectively a callable; it only has the __call__ method, and all subclasses must explicitly |
Module Contents
class aerosandbox.modeling.surrogate_model.SurrogateModel
: Bases: aerosandbox.common.AeroSandboxObject
code
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*)
: 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]
\_\_repr\_\_()
: Return type:
: str
input\_dimensionality()
: Returns the number of inputs that should be supplied in x, where x is the input to the SurrogateModel.
Return type:
: int
input\_names()
: If x (the input to this model) is supposed to be a dict, this method returns the keys that should be part of x.
If x is 1D and simply takes in floats or arrays, or if no x\_data exists, returns None.
Return type:
: Union[List, None]
plot(*resolution=250*)