pflm.fpca.utils.estimate_rho#

estimate_rho(method_rho: str, flatten_func_data: FlattenFunctionalData, reg_grid: ndarray, mu_obs: ndarray, mu_reg: ndarray, fpca_lambda: ndarray, fpca_phi_obs: ndarray, fpca_phi_reg: ndarray, fitted_cov: ndarray, sigma2: float) float[source][source]#

Estimate the optimal rho parameter for CE scoring.

Parameters:
method_rho{“ridge”, “truncated”}

Estimation strategy for rho.

flatten_func_dataFlattenFunctionalData

Flattened data (y, t, tid, unique_sid, sid_cnt).

reg_gridnp.ndarray of shape (n_reg_grid,)

Regular grid used to compute variance of reconstructed curves.

mu_obsnp.ndarray of shape (nt,)

Mean on the observation grid.

mu_regnp.ndarray of shape (n_reg_grid,)

Mean on the regular grid.

fpca_lambdanp.ndarray of shape (k,)

FPCA eigenvalues.

fpca_phi_obsnp.ndarray of shape (nt, k)

Basis on observation grid.

fpca_phi_regnp.ndarray of shape (n_reg_grid, k)

Basis on regular grid.

fitted_covnp.ndarray of shape (nt, nt)

Fitted covariance on observation grid.

sigma2float

Noise variance or starting value (for “truncated” path).

Returns:
float

Estimated rho value that best matches target variance.

Notes

Values of method_rho other than “ridge” are treated as “truncated”. When using float32, the results may not be the same with float64 because of the lower precision in calculations.