<< GetFuzzyMemberships CLUSTER GetPlaceOnSOM >>

CLUSTER >> CLUSTER > GetNearestNeighbor

GetNearestNeighbor

calculates for each sample vector the nearest neighbor among a set of cluster centers.

Calling Sequence

[Neighbors, Distances] = GetNearestNeighbor(Samples, Centers, NormType)
[Neighbors] = GetNearestNeighbor(Samples, Centers, NormType)

Parameters

Samples:

matrix, contains sample vectors as rows

Centers:

matrix, contains cluster centers as rows

NormType:

norm of vectors, must be a scalar greater than zeros, can be %inf

Neighbors:

column vector, contains the indices of nearest neighbor for each sample vector

Distances:

matrix, contains the distances between sample vectors (rows) and cluster centers (columns), optional

Description

This function calculates for each sample vector the nearest neighbor among a set of cluster centers.

Examples

global CLUSTER_PATH;
Source = read_csv(CLUSTER_PATH + 'demos\IrisData.csv', ascii(9));
Samples = strtod(Source(:, 1 : 4));
Centers = SelectRandomly(Samples, 5);
NearestNeighbors = GetNearestNeighbor(Samples(1 : 5, :), Centers, 2)

See also

Authors

Bibliography

Richard O. Duda, Peter E. Hart, David G. Stork, 'Pattern Classification', John Wiley & Sons Inc., New York, Chichester, Weinheim, Brisbane, Singapore, Toronto, Second Edition, 2001


Report an issue
<< GetFuzzyMemberships CLUSTER GetPlaceOnSOM >>