aerosandbox.modeling.surrogate_model ==================================== .. py:module:: aerosandbox.modeling.surrogate_model Classes ------- .. autoapisummary:: aerosandbox.modeling.surrogate_model.SurrogateModel Module Contents --------------- .. py:class:: SurrogateModel Bases: :py:obj:`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. .. py:method:: __call__(x) :abstractmethod: 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. .. py:method:: __repr__() .. py:method:: input_dimensionality() Returns the number of inputs that should be supplied in x, where x is the input to the SurrogateModel. .. py:method:: 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. .. py:method:: plot(resolution=250)