Description Usage Arguments Details Value Author(s) Examples
Predict a class given a list of neighbours obtained from k-nn using majority voting.
1 | classifier(cls, distance)
|
cls |
A list of neighbour classes found with |
distance |
An equal length list of neighbour distances. |
Todo: Distance weighted majority voting/distance kernel.
The majority prediction along with classification confidence.
phil
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # form the query instance.
query <- list(
sepal.length=5.84,
sepal.width=3.05,
petal.length=3.76,
petal.width=1.20)
# get the 10-nearest neighbours.
top.10 <- knn(query, iris.data, 10)
# classify the instance.
prediction <- classifier(top.10$species, top.10$distance)
# print the result.
print(paste("prediction =", prediction$pred,
"confidence =", prediction$conf))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.