How can I efficiently find a matrix D such that the cost function $||(M-D\cdot N)||$ is minimized?

119 Views Asked by At

Suppose that $M \in R^{P\,\text{x}\,K}$, $N \in R^{Q\,\text{x}\,K}$ , for P not necessarily having to equal Q, thus $D \in R^{P\,\text{x}\,Q}$

then given N and M matrices, let $C = M-D\cdot N$ = $\{C_{i,j}\}$

If the Cost function is defined as the norm of $C$ = norm of $(M-D\cdot N)$ = $\sum_{j=1}^{K}(\sum_{i=1}^{P}|c_{i,j}|^{2})^{1/2}$, then how can I efficiently find $D$ that minimizes such cost?

1

There are 1 best solutions below

7
On BEST ANSWER

Write it as $$ \|M-DN\|_F^2=\sum_{i=1}^P\|m_i^T-d_i^TN\|_2^2, $$ where $m_i$ and $d_i$ are the $i$th rows of the matrices $M$ and $D$, respectively. So it is clear that this is equivalent to $P$ independent linear least squares problems with solutions given by $$ d_i=N^{\dagger T}m_i, $$ where $N^\dagger$ is the Moore-Penrose pseudoinverse of $N$.