ComputeRPCA< TYPE > Class Template Reference
Last update: 16.07.2025Perform Robust Principal Component Analysis While traditional PCA is very sensitive to data corruption or outliers, RPCA is, as its name implies, robust to data corruption under surprisingly broad conditions. RPCA attempts to split a given matrix M into two matrices S and L: M = L + S where L is a low-rank matrix and S is a sparse matrix of random errors (of arbitrary magnitude and random sign). In the context of SoS, each column vector of M might be a particular field design. Without any prior knowledge about outliers, RPCA is then able to separate correlations between field designs (L) from outliers (S). Security camera footage is a good example, following the M = L + S data model: L represents the slowly changing background, while S represents walking people. See https://arxiv.org/abs/0912.3599 for more examples and a precise definition of the conditions, for RPCA to deliver good results. By default, ComputeRPCA creates two new quantity idents named RPCA[] (L) and RPCAError[] (S). Disable the creation of RPCAError by setting the createRPCAError member variable to false. The algorithm attempts to recover L and S by running the Principal Component Pursuit bi-objective optimization program:
![\[ //! \text{minimize} ||L||_* + \lambda ||S||_1 //! \text{subject to} L + S = M //! \]](/sites/default/files/migrate-content/optislang_3d_postprocessing_script_api_2024_r2_sp02_1/form_11.png)
where
denotes the nuclear norm of
(i.e. the sum of the singular values of
) and
denotes the
-norm of
seen as a long vector. Recommended value:
.
More...
Public Types | |
| typedef boost::function< DataObject::ptr_type(DataObject::ptr_type input)> | TAlgorithmFunction |
| defines a function object More... | |
| typedef boost::function< DataObject::ptr_type(Structure database, DataObject::ptr_type input)> | TAlgorithmFunction2 |
| defines a function object More... | |
Public Member Functions | |
| check (Structure database) | |
| checks the settings on plausibility It throws an exception if there is a problem with the settings. Important: It tries to find out all problems with these settings and then exits the routine. More... | |
| bool | compute (Structure database) |
| compute (Structure database, DataObject::ptr_type data, string new_quantity_ident, string new_design_ident) | |
| performs the action for a single set of samples More... | |
| ComputeRPCA () | |
| Create an RPCA object with default settings. | |
| ComputeRPCA (DataObjectContainer dataObjectFilter) | |
| Create an RPCA object with default settings and set the field data to perform RPCA on. More... | |
Public Attributes | |
| bool | createRPCAError |
| DataObjectContainer | data |
| the data set to be analyzed | |
| number | lambda |
| Singular value threshold parameter. Default: 0, lambda is set to 1/sqrt(max(n,m)), with n and m being the input matrix dimensions. | |
| number | maxIterations |
| Maximum number of iterations. Default: 200. | |
| DataObjectContainer::string_vector_type | new_quantity_idents |
| the new idents for each quantity. The dimension and index space must fit the one of quantity_idents | |
| bool | overwrite_existing |
| is true if already existing output data objects will be replaced. In this case, also all depending objects of the already existing one will be deleted. | |
| DataObjectContainer::string_vector_type | quantity_idents |
| the quantities to be analyzed. If a quantity ident does not exist in data, no error appears. | |
| number | relativeError |
| Iterate until relative error is reached. Default: 1e-9. | |
Detailed Description
template<dataobject_types TYPE>
class ComputeRPCA< TYPE >
Perform Robust Principal Component Analysis While traditional PCA is very sensitive to data corruption or outliers, RPCA is, as its name implies, robust to data corruption under surprisingly broad conditions. RPCA attempts to split a given matrix M into two matrices S and L: M = L + S where L is a low-rank matrix and S is a sparse matrix of random errors (of arbitrary magnitude and random sign). In the context of SoS, each column vector of M might be a particular field design. Without any prior knowledge about outliers, RPCA is then able to separate correlations between field designs (L) from outliers (S). Security camera footage is a good example, following the M = L + S data model: L represents the slowly changing background, while S represents walking people. See https://arxiv.org/abs/0912.3599 for more examples and a precise definition of the conditions, for RPCA to deliver good results. By default, ComputeRPCA creates two new quantity idents named RPCA[] (L) and RPCAError[] (S). Disable the creation of RPCAError by setting the createRPCAError member variable to false. The algorithm attempts to recover L and S by running the Principal Component Pursuit bi-objective optimization program:
![\[ //! \text{minimize} ||L||_* + \lambda ||S||_1 //! \text{subject to} L + S = M //! \]](/sites/default/files/migrate-content/optislang_3d_postprocessing_script_api_2024_r2_sp02_1/form_11.png)
where
denotes the nuclear norm of
(i.e. the sum of the singular values of
) and
denotes the
-norm of
seen as a long vector. Recommended value:
.
- Template Parameters
-
TYPE the field data type
Member Typedef Documentation
◆ TAlgorithmFunction
|
inherited |
defines a function object
- Parameters
-
input a single input object
- Returns
- the result of the operation
◆ TAlgorithmFunction2
|
inherited |
defines a function object
- Parameters
-
database the database we refer to input a single input object
- Returns
- the result of the operation
Constructor & Destructor Documentation
◆ ComputeRPCA()
| ComputeRPCA | ( | DataObjectContainer | dataObjectFilter | ) |
Create an RPCA object with default settings and set the field data to perform RPCA on.
- Parameters
-
dataObjectFilter the field data to perform RPCA on
Member Function Documentation
◆ check()
|
inherited |
checks the settings on plausibility It throws an exception if there is a problem with the settings. Important: It tries to find out all problems with these settings and then exits the routine.
- Parameters
-
database the SoS structure
◆ compute()
|
inherited |
performs the action for a single set of samples
- Parameters
-
database the output object is to be inserted in this object data the input data object new_quantity_ident the quantity ident of the new object new_design_ident the design ident of the new object If the input object is active, then the output object will be active as well (or inactive, respectively).