Inverse Distance Weighting#

inverse_distance_weighting(known_points, unknown_location, number_of_neighbours=-1, power=2.0)[source]

Inverse Distance Weighting with a given set of points and an unknown location.

Parameters:
known_pointsnumpy array

The MxN array, where M is a number of rows (points) and N is the number of columns, where the last column represents a value of a known point. (It could be (N-1)-dimensional data).

unknown_locationIterable

Array or list with coordinates of the unknown point. It’s length is N-1 (number of dimensions). The unknown location shape should be the same as the known_points parameter shape, if not, then new dimension is added once - vector of points [x, y] becomes [[x, y]] for 2-dimensional data.

number_of_neighboursint, default = -1

If default value (-1) then all known points will be used to estimate value at the unknown location. Can be any number within the limits [2, len(known_points)],

powerfloat, default = 2.

Power value must be larger or equal to 0. It controls weight assigned to each known point. Larger power means stronger influence of the closest neighbors, but it decreases quickly.

Returns:
resultfloat

The estimated value.

Raises:
ValueError

Power parameter set to be smaller than 0.

ValueError

Less than 2 neighbours or more than the number of known_points neighbours are given in the number_of_neighbours parameter.