qolmat.imputations.rpca.rpca_pcp.RpcaPcp

class qolmat.imputations.rpca.rpca_pcp.RpcaPcp(random_state: Optional[Union[int, RandomState]] = None, mu: Optional[float] = None, lam: Optional[float] = None, max_iterations: int = 10000, tolerance: float = 1e-06, verbose: bool = True)[source]

Class for the basic RPCA decomposition.

It uses Alternating Lagrangian Multipliers.

Parameters
random_stateint, optional

The seed of the pseudo random number generator to use, for reproducibility.

period: Optional[int]

number of rows of the reshaped matrix if the signal is a 1D-array

rank: Optional[int]

(estimated) low-rank of the matrix D

mu: Optional[float]

Parameter for the convergence and shrinkage operator

lam: Optional[float]

penalizing parameter for the sparse matrix

max_iterations: Optional[int]

stopping criteria, maximum number of iterations. By default, the value is set to 10_000

tolerance: Optional[float]

stopping criteria, minimum difference between 2 consecutive iterations. By default, the value is set to 1e-6

verbose: Optional[bool]

verbosity level, if False the warnings are silenced

References

Candès, Emmanuel J., et al. “Robust principal component analysis.” Journal of the ACM (JACM) 58.3 (2011): 1-37

__init__(random_state: Optional[Union[int, RandomState]] = None, mu: Optional[float] = None, lam: Optional[float] = None, max_iterations: int = 10000, tolerance: float = 1e-06, verbose: bool = True) None[source]
decompose(D: ndarray[tuple[int, ...], dtype[_ScalarType_co]], Omega: ndarray[tuple[int, ...], dtype[_ScalarType_co]]) Tuple[ndarray[tuple[int, ...], dtype[_ScalarType_co]], ndarray[tuple[int, ...], dtype[_ScalarType_co]]][source]

Estimate the relevant parameters.

It computes the PCP RPCA decomposition, using the Augmented Largrangian Multiplier (ALM)

Parameters
DNDArray

Matrix of the observations

Omega: NDArray

Matrix of missingness, with boolean data

Returns
M: NDArray

Low-rank signal

A: NDArray

Anomalies

get_params_scale(D: ndarray[tuple[int, ...], dtype[_ScalarType_co]])[source]

Get parameters for scaling in RPCA based on the input data.

Parameters
Dnp.ndarray

Input data matrix of shape (m, n).

Returns
dict
A dictionary containing the following parameters:
  • “mu”float

    Parameter for the convergence and shrinkage operator

  • “lam”float

    Regularization parameter for the L1 norm.