predict.ldaGSVD {LDATree} | R Documentation |
Predictions from a fitted ldaGSVD object
Description
Prediction of test data using a fitted ldaGSVD object
Usage
## S3 method for class 'ldaGSVD'
predict(object, newdata, type = c("response", "prob"), ...)
Arguments
object |
a fitted model object of class |
newdata |
data frame containing the values at which predictions are required. Missing values are NOT allowed. |
type |
character string denoting the type of predicted value returned.
The default is to return the predicted class ( |
... |
further arguments passed to or from other methods. |
Details
Unlike the original paper, which uses the k-nearest neighbor (k-NN) as the
classifier, we use a faster and more straightforward likelihood-based method.
One limitation of the traditional likelihood-based method for LDA is that it
ceases to work when there are Linear Discriminant (LD) directions with zero
variance in the within-class scatter matrix. However, when using LDA/GSVD,
all chosen LD directions possess non-zero variance in the between-class
scatter matrix. This implies that LD directions with zero variance in the
within-class scatter matrix will yield the highest Fisher's ratio. Therefore,
to get these directions higher weights, we manually adjust the zero variance
to 1e-15
for computational reasons.
Value
The function returns different values based on the type
, if
-
type = 'response'
: vector of predicted responses. -
type = 'prob'
: a data frame of the posterior probabilities. Each class takes a column.
References
Ye, J., Janardan, R., Park, C. H., & Park, H. (2004). An optimization criterion for generalized discriminant analysis on undersampled problems. IEEE Transactions on Pattern Analysis and Machine Intelligence
Howland, P., Jeon, M., & Park, H. (2003). Structure preserving dimension reduction for clustered text data based on the generalized singular value decomposition. SIAM Journal on Matrix Analysis and Applications
Examples
fit <- ldaGSVD(Species~., data = iris)
predict(fit,iris)
# output prosterior probabilities
predict(fit,iris,type = "prob")