mvtsa.representation.RecursivePCA#
- class mvtsa.representation.RecursivePCA(forgetting=0.99, variable=True, lambda_min=0.9, lambda_max=0.9999, n_components=0.95, lags=0, ridge=1e-06)[source]#
Bases:
objectRecursive (exponentially weighted) PCA with a variable forgetting factor.
The mean and covariance are updated sample by sample,
\[d_t = x_t-\mu_{t-1},\quad \mu_t=\mu_{t-1}+(1-\lambda_t)d_t,\quad \Sigma_t=\lambda_t\bigl(\Sigma_{t-1}+(1-\lambda_t)d_td_t^{\mathsf T}\bigr),\]so that a covariance matrix – and a PCA model – is available at every sampling time. With
variable=Truethe forgetting factor follows the constant-information principle of Fortescue, Kershenbaum and Ydstie (1981): a sample that the current model explains badly (large Mahalanobis distance \(m_t\) of \(d_t\)) shortens the memory,\[\lambda_t = \operatorname{clip}\bigl(1-(1-\lambda_0)\,m_t/n,\;\lambda_{\min},\;\lambda_{\max}\bigr),\]which lets the model adapt quickly after a change of the operating range (Dobos and Abonyi, 2012).
- Parameters:
- forgetting
float Nominal forgetting factor \(\lambda_0\) (memory about \(1/(1-\lambda_0)\) samples).
- variablebool
Use the variable forgetting factor.
- lambda_min, lambda_max
float Bounds of the variable forgetting factor.
- n_components
intorfloat Retained components of the current model.
- lags
int Dynamic PCA: the updates use lag-extended samples.
- forgetting