Description Usage Arguments Value References Examples
This function provides several algorithms to solve the following problem
\textrm{max} \frac{tr(V^\top A V)}{tr(V^\top B V)} \textrm{ such that } V^\top C V = I
where V is a projection matrix, i.e., V^\top V = I. Trace ratio optimization is pertained to various linear dimension reduction methods. It should be noted that when C = I, the above problem is often reformulated as a generalized eigenvalue problem since it's an easier proxy with faster computation.
1 2 3 4 5 6 7 8 9 |
A |
a (p\times p) symmetric matrix in the numerator term. |
B |
a (p\times p) symmetric matrix in the denomiator term. |
C |
a (p\times p) symmetric constraint matrix. If not provided, it is set as identical matrix automatically. |
dim |
an integer for target dimension. It can be considered as the number of loadings. |
method |
the name of algorithm to be used. Default is |
maxiter |
maximum number of iterations to be performed. |
eps |
stopping criterion for iterative algorithms. |
a named list containing
a (p\times dim) projection matrix.
an attained maximum scalar value.
guo_generalized_2003maotai
\insertRefwang_trace_2007maotai
\insertRefyangqingjia_trace_2009maotai
\insertRefngo_trace_2012maotai
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | ## simple test
# problem setting
p = 5
mydim = 2
A = matrix(rnorm(p^2),nrow=p); A=A%*%t(A)
B = matrix(runif(p^2),nrow=p); B=B%*%t(B)
C = diag(p)
# approximate solution via determinant ratio problem formulation
eigAB = eigen(solve(B,A))
V = eigAB$vectors[,1:mydim]
eigval = sum(diag(t(V)%*%A%*%V))/sum(diag(t(V)%*%B%*%V))
# solve using 4 algorithms
m12 = trio(A,B,dim=mydim, method="2012Ngo")
m09 = trio(A,B,dim=mydim, method="2009Jia")
m07 = trio(A,B,dim=mydim, method="2007Wang")
m03 = trio(A,B,dim=mydim, method="2003Guo")
# print the results
line1 = '* Evaluation of the cost function'
line2 = paste("* approx. via determinant : ",eigval,sep="")
line3 = paste("* trio by 2012Ngo : ",m12$tr.val, sep="")
line4 = paste("* trio by 2009Jia : ",m09$tr.val, sep="")
line5 = paste("* trio by 2007Wang : ",m07$tr.val, sep="")
line6 = paste("* trio by 2003Guo : ",m03$tr.val, sep="")
cat(line1,"\n",line2,"\n",line3,"\n",line4,"\n",line5,"\n",line6)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.