Kernel Marginal Fisher Analysis (KMFA) is a nonlinear variant of MFA using kernel tricks.
For simplicity, we only enabled a heat kernel of a form
do.kmfa(
X,
label,
ndim = 2,
preprocess = c("center", "scale", "cscale", "decorrelate", "whiten"),
k1 = max(ceiling(nrow(X)/10), 2),
k2 = max(ceiling(nrow(X)/10), 2),
t = 1
)
an
a length-
an integer-valued target dimension.
an additional option for preprocessing the data.
Default is "center". See also aux.preprocess
for more details.
the number of same-class neighboring points (homogeneous neighbors).
the number of different-class neighboring points (heterogeneous neighbors).
bandwidth parameter for heat kernel in
a named list containing
an
a list containing information for out-of-sample prediction.
yan_graph_2007Rdimtools
# NOT RUN {
## generate data of 3 types with clear difference
dt1 = aux.gensamples(n=33)-100
dt2 = aux.gensamples(n=33)
dt3 = aux.gensamples(n=33)+100
## merge the data and create a label correspondingly
X = rbind(dt1,dt2,dt3)
label = c(rep(1,33), rep(2,33), rep(3,33))
## try different numbers for neighborhood size
out1 = do.kmfa(X, label, k1=5, k2=5, t=1)
out2 = do.kmfa(X, label, k1=5, k2=5, t=2)
## visualize
opar = par(no.readonly=TRUE)
par(mfrow=c(1,2))
plot(out1$Y, main="bandwidth=1")
plot(out2$Y, main="bandwidth=2")
par(opar)
# }
Run the code above in your browser using DataLab