gemmr.model_selection.n_components_to_explain_variance

gemmr.model_selection.n_components_to_explain_variance(covariance_matrix, variance_threshold=0.9)

Given a covariance matrix, find the number of components necessary to explain at least variance_threshold variance.

Parameters:
  • covariance_matrix (np.ndarray (n_features, n_features)) – a covariance matrix, needs to be symmetric and positive definite

  • variance_threshold (float between 0 and 1) – amount of variance to be explained by the determined number of components

Returns:

n_components – number of components required to explain variance_threshold of variance

Return type:

int