nearest_neighbor.py

class openmdao.surrogate_models.nearest_neighbor.NearestNeighbor(interpolant_type='rbf', **kwargs)[source]

Bases: openmdao.surrogate_models.surrogate_model.SurrogateModel

Surrogate model that approximates values using a nearest neighbor approximation. interpolant_type argument must be one of ‘linear’, ‘weighted’, or ‘rbf’.

Args:

interpolant_type : str

One of ‘linear’, ‘weighted’, or ‘rbf’. Determines the type of interpolant used.

kwargs :

Additional keyword arguments to be passed to the constructor for the interpolant.

linearize(x, **kwargs)[source]

Calculates the jacobian of the interpolant at the requested point.

Args:

x : array-like

Point at which the surrogate Jacobian is evaluated.

kwargs :

Additional keyword arguments passed to the interpolant.

predict(x, **kwargs)[source]

Calculates a predicted value of the response based on the current trained model for the supplied list of inputs.

Args:

x : array-like

Point(s) at which the surrogate is evaluated.

kwargs :

Additional keyword arguments passed to the interpolant.

train(x, y)[source]

Train the surrogate model with the given set of inputs and outputs.

Args:

x : array-like

Training input locations

y : array-like

Model responses at given inputs.