KLFDA | R Documentation |
This function performs Kernel local Fisher discriminant analysis. The function provided here allows users to carry out the KLFDA using other input datasets. We used the gaussan matrix as example. Users can input the
KLFDA(kdata, y, r, sigma = 0.5, metric = c("weighted", "orthonormalized", "plain"),tol=1e-5,knn = 6, reg = 0.001)
kdata |
The input dataset (kernel matrix). The input data can be a genotype matrix, dataframe, species occurence matrix, or principal components. The dataset have to convert to a kernel matrix before feed into this function. |
y |
The group lables |
r |
Number of reduced features |
sigma |
The sigma used to estimate gaussan matrix. |
metric |
Type of metric in the embedding space (default: 'weighted') 'weighted' - weighted eigenvectors 'orthonormalized' - orthonormalized 'plain' - raw eigenvectors |
knn |
The number of nearest neighbours |
reg |
The regularization parameter |
Z |
The reduced features |
Tr |
The transformation matrix |
Tang, Y., & Li, W. (2019). lfda: Local Fisher Discriminant Analysis inR. Journal of Open Source Software, 4(39), 1572.
KLFDAPC
kmat <- kmatrixGauss(iris[, -5],sigma=1) zklfda=KLFDA(kmat, iris[, 5], r=3,tol=1e-5, metric = "plain") print(zklfda$Z)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.