Define the LinearInterpolator class.

class openmdao.surrogate_models.nn_interpolators.linear_interpolator.LinearInterpolator(training_points, training_values, num_leaves=2)[source]

Bases: openmdao.surrogate_models.nn_interpolators.nn_base.NNBase

Interpolate values by forming a hyperplane between the points closest to the prescribed inputs.

__init__(training_points, training_values, num_leaves=2)

Initialize nearest neighbor interpolant by scaling input to the unit hypercube.


training_points : ndarray

ndarray of shape (num_points x independent dims) containing training input locations.

training_values : ndarray

ndarray of shape (num_points x dependent dims) containing training output values.

num_leaves : int

How many leaves the tree should have.


Find the gradient at each location of a set of supplied predicted points.


prediciton_points : ndarray

Prediction points at which the gradient is calculated.



Gradient at the prediction points.