The qkernel Sammon Mapping is an implementation for Sammon mapping, one of the earliest dimension reduction techniques that aims to find low-dimensional embedding that preserves pairwise distance structure in high-dimensional data space. qsammon is a nonlinear form of Sammon Mapping.
# S4 method for matrix
qsammon(x, kernel = "rbfbase", qpar = list(sigma = 0.5, q = 0.9),
dims = 2, Initialisation = 'random', MaxHalves = 20,
MaxIter = 500, TolFun = 1e-7, na.action = na.omit, ...)# S4 method for cndkernmatrix
qsammon(cndkernel, x, k, dims = 2, Initialisation = 'random',
MaxHalves = 20,MaxIter = 500, TolFun = 1e-7, ...)
# S4 method for qkernmatrix
qsammon(qkernel, x, k, dims = 2, Initialisation = 'random',
MaxHalves = 20, MaxIter = 500, TolFun = 1e-7, ...)
the data matrix indexed by row or a kernel matrix of cndkernmatrix
or qkernmatrix
.
the kernel function used in training and predicting. This parameter can be set to any function, of class kernel, which computes a kernel function value between two vector arguments. qkerntool provides the most popular kernel functions which can be used by setting the kernel parameter to the following strings:
rbfbase
Radial Basis qkernel function "Gaussian"
nonlbase
Non Linear qkernel function
laplbase
Laplbase qkernel function
ratibase
Rational Quadratic qkernel function
multbase
Multiquadric qkernel function
invbase
Inverse Multiquadric qkernel function
wavbase
Wave qkernel function
powbase
d qkernel function
logbase
Log qkernel function
caubase
Cauchy qkernel function
chibase
Chi-Square qkernel function
studbase
Generalized T-Student qkernel function
nonlcnd
Non Linear cndkernel function
polycnd
Polynomial cndkernel function
rbfcnd
Radial Basis cndkernel function "Gaussian"
laplcnd
Laplacian cndkernel function
anocnd
ANOVA cndkernel function
raticnd
Rational Quadratic cndkernel function
multcnd
Multiquadric cndkernel function
invcnd
Inverse Multiquadric cndkernel function
wavcnd
Wave cndkernel function
powcnd
d cndkernel function
logcnd
Log cndkernel function
caucnd
Cauchy cndkernel function
chicnd
Chi-Square cndkernel function
studcnd
Generalized T-Student cndkernel function
The kernel parameter can also be set to a user defined function of class kernel by passing the function name as an argument.
the list of hyper-parameters (kernel parameters). This is a list which contains the parameters to be used with the kernel function. Valid parameters for existing kernels are :
sigma, q
for the Radial Basis qkernel function "rbfbase" , the Laplacian qkernel function "laplbase" and the Cauchy qkernel function "caubase".
alpha, q
for the Non Linear qkernel function "nonlbase".
c, q
for the Rational Quadratic qkernel function "ratibase" , the Multiquadric qkernel function "multbase" and the Inverse Multiquadric qkernel function "invbase".
theta, q
for the Wave qkernel function "wavbase".
d, q
for the d qkernel function "powbase" , the Log qkernel function "logbase" and the Generalized T-Student qkernel function "studbase".
alpha
for the Non Linear cndkernel function "nonlcnd".
d, alpha, c
for the Polynomial cndkernel function "polycnd".
gamma
for the Radial Basis cndkernel function "rbfcnd" and the Laplacian cndkernel function "laplcnd" and the Cauchy cndkernel function "caucnd".
d, sigma
for the ANOVA cndkernel function "anocnd".
c
for the Rational Quadratic cndkernel function "raticnd" , the Multiquadric cndkernel function "multcnd" and the Inverse Multiquadric cndkernel function "invcnd".
theta
for the Wave cndkernel function "wavcnd".
d
for the d cndkernel function "powcnd" , the Log cndkernel function "logcnd" and the Generalized T-Student cndkernel function "studcnd".
Hyper-parameters for user defined kernels can be passed through the qpar parameter as well.
the kernel function to be used to calculate the qkernel matrix.
the cndkernel function to be used to calculate the CND kernel matrix.
the dimension of the original data.
Number of features to return. (default: 2)
"random"
or "pca"
; the former performs
fast random projection and the latter performs standard PCA (default : "random")
maximum number of step halvings. (default : 20)
the maximum number of iterations allowed. (default : 500)
relative tolerance on objective function. (default : 1e-7)
A function to specify the action to be taken if NA
s are
found. The default action is na.omit
, which leads to rejection of cases
with missing values on any required variable. An alternative
is na.fail
, which causes an error if NA
cases
are found. (NOTE: If given, this argument must be named.)
additional parameters
The matrix whose rows are embedded observations.
The function call contained
The kernel function used
Using kernel functions one can efficiently compute
principal components in high-dimensional
feature spaces, related to input space by some non-linear map.
The data can be passed to the qsammon
function in a matrix
, in addition qsammon
also supports input in the form of a
kernel matrix of class qkernmatrix
or class cndkernmatrix
.
Sammon, J.W. (1969) A Nonlinear Mapping for Data Structure Analysis. IEEE Transactions on Computers, C-18 5:401-409.
# NOT RUN {
data(iris)
train <- as.matrix(iris[,1:4])
labeltrain<- as.integer(iris[,5])
## S4 method for signature 'matrix'
kpc2 <- qsammon(train, kernel = "rbfbase", qpar = list(sigma = 2, q = 0.9), dims = 2,
Initialisation = 'pca', TolFun = 1e-5)
plot(dimRed(kpc2), col = as.integer(labeltrain))
cndkernf(kpc2)
# }
Run the code above in your browser using DataLab