Be the first to rate this file! 16 Downloads (last 30 days) File Size: 2.4 KB File ID: #31612

1-nearest neighbor with accuracy, precision and recall

by

 

INPUTS:TEST SET,TRAINING SET,GROUP,K-VALUE,DISTANCE,RULE OUTPUT:ACCURACY,PRECISION,RECALL

| Watch this File

File Information
Description

TO FIND THE K NEAREST NEIGHBOUR ::

FORMULA ::
        Class = knnclassify(Test, Training, Group, k, distance, rule)

INPUTS :-
        TEST SET, TRAINING SET, GROUP, VALUE OF K, DISTANCE, RULE
        
TEST, TRAINING - MATRIX
GROUP - GROUPING OF ROWS
K - NUMBER OF NEAREST NEIGHBOR USED IN CLASSIFICATION
DISTANCE - EUCLIDEAN
RULE - NEAREST
        
OUTPUT :-
        CLASS MATRIX WHICH SHOWS THE NEAREST NEIGHBORS OF EACH ROW ie.,ROW 1 OF TEST IS CLOSEST TO ROW 3 OF TRAINING.THEN I CALCULATED TRUE POSITIVE, TRUE NEGATIVE, FALSE POSITIVE, FALSE NEGATIVE USING THAT I CALCULATED ACCURACY, PRESICION, RECALL

Required Products MATLAB Compiler
MATLAB release MATLAB 7.5 (R2007b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (1)
26 Nov 2014 yildiz

ı don 't understand this column
if( ( train(class(i), 11) == 4 ) && ( test(i, 11) == 4 ) )
true_positive = true_positive + 1;
elseif( ( train(class(i), 11) == 2 ) && ( test(i, 11) == 2 ) )

Why we use 4 or 2 can you send me test.txt and train .txt

Contact us