PRTools contents

PRTools manual

knn_map

KNN_MAP

Map a dataset on a K-NN classifier

    F = KNN_MAP(A,W)

Input
 A Dataset
 W K-NN classifier trained by KNNC

Output
 F Posterior probabilities

Description

Maps the dataset A by the K-NN classifier W on the [0,1] interval for  each of the classes that W is trained on. The posterior probabilities,  stored in F, are computed in the following ways
soft labeled training set: the normalised average of the soft labels  of the K neighbors.  crisp labeled training set, K = 1: normalisation of sigm(log(F)) with  F(1:C) = sum(NN_Dist(1:C))./NN_Dist(1:C) - 1 in which C is the number of classes and NN_Dist stores  the distance to the nearest neighbor of each class.  crisp labeled training set, K > 1: normalisation of  (N(1:C) + 1)/(K+C), in which N stores the number of  objects per class within the K first neighbors.

This routine is called automatically to determine A*W if W is trained  by KNNC.

Warning: Class prior probabilities in the dataset A are neglected.

See also

mappings, datasets, knnc, testk,

PRTools contents

PRTools manual