factor_correspondence | R Documentation |
WITH error handling if matrices are not same size, NA If nn is false, we allow *signed permutations* find a matching between two sets of factors (presented as columns of matrices A and B) that minimizes the sum of the squared errors.
factor_correspondence(A, B, nn = TRUE)
Assumes that A and B have columns of unit L2 norm. Looks for a permutation matrix (or signed permutation matrix) Pi such that
|| A - B * Pi ||_F^2
is minimized.
Uses an (exact) Lp relaxation, solved via the cvx package.
Inputs A, B matrices of the same size, with unit L2 norm columns nn boolean, optional, default true. If nn, we search for a *permutation* matrix Pi. If nn is false, we allow *signed permutations* which can multiply the factors by -1.
Outputs e – the sum of squared errors under the best calibration Pi Pi – the permutation or signed permutation matrix
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.