emd.cycles.kdt_match#

emd.cycles.kdt_match(x, y, K=15, distance_upper_bound=inf)[source]#

Find unique nearest-neighbours between two n-dimensional feature sets.

Useful for matching two sets of cycles on one or more features (ie amplitude and average frequency).

Rows in x are matched to rows in y. As such - it is good to have (many) more rows in y than x if possible.

This uses a k-dimensional tree to query for the K nearest neighbours and returns the closest unique neighbour. If no unique match is found - the row is not returned. Increasing K will find more matches but allow matches between more distant observations.

Not advisable for use with more than a handful of features.

Parameters:
xndarray

[ num observations x num features ] array to match to

yndarray

[ num observations x num features ] array of potential matches

Kint

number of potential nearest-neigbours to query

Returns:
ndarray

indices of matched observations in x

ndarray

indices of matched observations in y