lib5c.algorithms.express module¶
Module for implementation of the “Express” algorithm from Sauria et al. 2015.
-
lib5c.algorithms.express.
express_normalize_matrix
(obs_matrix, exp_matrix, max_iter=1000, eps=0.0001)[source]¶ Express balance a matrix given a corresponding expected matrix.
- Parameters
obs_matrix (np.ndarray) – The matrix to normalize.
exp_matrix (np.ndarray) – The expected matrix corresponding to the obs_matrix.
max_iter (int) – The maximum number of iterations.
eps (float) – When the fractional change in the residual is less than this number, the algorithm is considered to have converged and will stop iterating.
- Returns
The first element of the tuple is the normalized matrix. The second element is the multiplicative bias vector. The third element is a list containing the L1 norm of the residual at every iteration.
- Return type
Tuple[np.ndarray, np.ndarray, List[float]]
-
lib5c.algorithms.express.
joint_express_normalize
(obs_matrices, exp_matrices, max_iter=1000, eps=0.0001)[source]¶ Express balance a set of matrices given a set of corresponding expected matrices, using a single shared bias vector.
- Parameters
obs_matrices (List[np.ndarray]) – The matrix to normalize.
exp_matrices (List[np.ndarray]) – The expected matrix corresponding to the obs_matrix.
max_iter (int) – The maximum number of iterations.
eps (float) – When the fractional change in the residual is less than this number, the algorithm is considered to have converged and will stop iterating.
- Returns
The first element of the tuple is the list of normalized matrices. The second element is the multiplicative bias vector. The third element is a list containing the L1 norm of the residual at every iteration.
- Return type
Tuple[List[np.ndarray], np.ndarray, List[float]]