Description Usage Arguments Value Author(s) Examples
Compute the error of the predict list given the true list.
1 |
predict |
The list of predicted labels |
true |
The list of true labels |
It returns the errors of the predicted labels from a classification algorithm.
Wei Sun, Xingye Qiao, and Guang Cheng
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # Training data
set.seed(1)
n = 100
d = 10
DATA = mydata(n, d)
# Testing data
set.seed(2015)
ntest = 100
TEST = mydata(ntest, d)
TEST.x = TEST[,1:d]
TEST.y = TEST[,d+1]
## Compute the errors for knn, bnn, ownn, and snn with given parameters.
predict.knn = myknn(DATA, TEST.x, K = 5)
predict.bnn = mybnn(DATA, TEST.x, ratio = 0.5)
predict.ownn = myownn(DATA, TEST.x, K = 5)
predict.snn = mysnn(DATA, TEST.x, lambda = 10)
myerror(predict.knn, TEST.y)
myerror(predict.bnn, TEST.y)
myerror(predict.ownn, TEST.y)
myerror(predict.snn, TEST.y)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.