factor_correspondence: Factor correspondence

factor_correspondenceR Documentation

Factor correspondence

Description

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.

Usage

factor_correspondence(A, B, nn = TRUE)

Details

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


Columbia-PRIME/PCPhelpers documentation built on April 24, 2022, 7:57 p.m.