linear_interpolator.py

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.

Parameters:

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.

gradient(prediciton_points)[source]

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

Parameters:

prediciton_points : ndarray

Prediction points at which the gradient is calculated.

Returns:

ndarray

Gradient at the prediction points.