function [class] = getcentroid(test,db0, db1) % Classify the point 'test' in the following way: % 1. find the most representative element of each class % 2. compare the similarity of test to each most rep element % 3. sim(test,u1) > sim(test, u0) => class 1 % Inputs: % 1. test: vector length m % 2. db0 : n*m matrix of elements from class0 % 3. db1: n*m matrix of elements from class1 [u1] = getMostRepElement(db1); [u0] = getMostRepElement(db0); centroid0 = db0(u0, :); centroid1 = db1(u1, :); [AintersectB AnotB BnotA] = featurescomp(centroid0, test); sim0 = simCounting(AintersectB, AnotB