Learn R Programming

hsicCCA (version 1.0)

ktaCCAfunc: Canonical Correlation Analysis based on the centered kernel target alignment.

Description

Given two multi-dimensional data sets, find a pair of canonical projection pairs that maximizes the kernel alignment criterion. Called by ktaCCA, and intended for internal use, but users may play with it for potential finer controls.

Usage

ktaCCAfunc(x, y, Wx = NULL, Wy = NULL, sigmax, sigmay, numiter = 20, reltolstop = 1e-04)

Arguments

x
The x-variable data matrix. One row per observation.
y
The y-variable data matrix. One row per observation.
Wx
Initial projection vector for the x data set. Randomly set if NULL.
Wy
Initial projection vector for the y data set. Randomly set if NULL.
sigmax
The bandwidth parameter for the Gaussian kernel on the x-variable set. A positive value. The smaller the smoother.
sigmay
The bandwidth parameter for the Gaussian kernel on the y-variable set. A positive value. The smaller the smoother.
numiter
Maximum number of iterations.
reltolstop
Convergence threshold. Algorithm stops when relative changes in cost from consecutive iterations is less than the threshold.

Value

A list containing:
Wx
The canoncial projection vector for the x-variable set.
Wy
The canoncial projection vector for the y-variable set.
cost
A vector of (negative) cost values at each iteration.

Details

Optimization is done by gradient descent, where Nelder-Mead is used for step-size selection. Nelder Mead may fail to increase the cost at times (when stuck at local minima). User may consider restarting the algorithm when this happens.

References

Chang et. al. (2013) Canonical Correlation Analysis based on Hilbert-Schmidt Independence Criterion and Centered Kernel Target Alignment. ICML 2013.

Cortes et. al. (2012) Algorithms for learning kernels based on centered alignments. JMLR 13:795-828.

See Also

ktaCCA

Examples

Run this code
set.seed(10)
numData <- 100
numDim <- 2
x <- matrix(rnorm(numData*numDim),numData,numDim)
y <- matrix(rnorm(numData*numDim),numData,numDim)
z <- runif(numData,-pi,pi)
y[,1] <- cos(z)+rnorm(numData,sd=0.1); x[,1] <- sin(z)+rnorm(numData,sd=0.1)
x <- scale(x)
y <- scale(y)

fit <- ktaCCAfunc(x,y,sigmax=1,sigmay=1)
plot(x%*%fit$Wx,y%*%fit$Wy)

Run the code above in your browser using DataLab