knn: k-Nearest Neighbour k-nearest neighbour...

Description Usage Arguments Value Examples

Description

k-Nearest Neighbour k-nearest neighbour classification/Regression for test set from training set. For each row of the test set, the k nearest (according to distance metric speicified) training set vectors are found, and the classification is decided by majority vote, with ties broken at random. If there are ties for the kth nearest vector, all candidates are included in the vote. If classify flag is false, average of k neighbours is returned.

Usage

1
2
knn(train, test = train, cl = "NULL", k = 1, l = 0, prob = FALSE,
  use.all = FALSE, ...)

Arguments

train

input deep FLTable

test

input deep FLTable

cl

ColumnName of true classifications of training set

k

number of neighbours considered.

prob

If this is true, the proportion of the votes for the winning class are returned as attribute prob.

classify

logical if classification/regression is solved

metric

distance metric to be used. euclidean, manhattan supported.

Value

FLVector of classifications of test set.

Examples

1
2
3
4
FLdeepTbl <- FLTable(getTestTableName("ARknnDevSmall"),"obsid","varid","num_val")
FLknnOutput <- knn(FLdeepTbl,k=3,prob=TRUE)
FLknnOutput
attributes(FLknnOutput)$prob

Fuzzy-Logix/AdapteR documentation built on May 6, 2019, 5:07 p.m.