kfda.predict {kfda} | R Documentation |
Predict Method for Kernel Fisher Discriminant Analysis (KFDA) fit
Description
Test the testData using KFDA. This function is used after training phase is performed using the kfda function.
Usage
kfda.predict(object = obj, testData = data)
Arguments
object |
An |
testData |
an optional |
Details
Since this function inherits KPCA
and LDA
, various learning can be possible by adjusting the hyper-parameters of each function.
Value
The result of performing testData on the KFDA model.
class |
A class label of testData. |
posterior |
A posterior probabilities for the classes. |
x |
The scores of testData on up to |
Author(s)
Donghwan Kim
ainsuotain@hanmail.net
donhkim9714@korea.ac.kr
dhkim2@bistel.com
References
Yang, J., Jin, Z., Yang, J. Y., Zhang, D., and Frangi, A. F. (2004) <DOI:10.1016/j.patcog.2003.10.015>. Essence of kernel Fisher discriminant: KPCA plus LDA. Pattern Recognition, 37(10): 2097-2100.
See Also
Examples
# data input
data(iris)
# data separation
idx <- sample(1:dim(iris)[1], round(dim(iris)[1]*0.7))
trainData <- iris[idx, ]
testData <- iris[-(idx), -dim(iris)[2]]
testData.Label <- iris[-(idx), dim(iris)[2]]
# training KFDA model
kfda.model <- kfda(trainData = trainData, kernel.name = "rbfdot")
# testing new(test)data by KFDA model
pre <- kfda.predict(object = kfda.model, testData = testData)
# plotting
plot(kfda.model$LDs, col = kfda.model$label, pch = 19, main = "Plot for KFDA")
points(pre$x, col = pre$class, cex = 2)
legend("topleft", legend = c("trainData","testData"), pch = c(19,1))
# prediction result
table(pre$class, (testData.Label))