linear_shrink_target¶
-
hd.
linear_shrink_target
(cov, target, step=0.05, max_iter=100)[source]¶ Linearly shrink a covariance matrix until a condition number target is reached. Useful for reducing the impact of outliers in
nerive()
.- Parameters
- covnumpy.ndarray, shape = (p, p)
The covariance matrix.
- target: float > 1
The highest acceptable condition number.
- stepfloat > 0
The linear shrinkage parameter for each step.
- max_iterint > 1
The maximum number of iterations until giving up.
- Returns
- covnumpy.ndarray, shape = (p, p)
The linearly shrunk covariance matrix estimate.