OCDocker.OCScore.Dimensionality.PCA module

Module with a helper to execute the Principal Component Analysis (PCA) on the datasets.

It is imported as:

import OCDocker.OCScore.Optimization.PCA as ocpca

OCDocker.OCScore.Dimensionality.PCA.run_pca(df_path, variance, pca_path, verbose=False)[source]

Function to run PCA on the datasets.

Parameters:
  • df_path (str) – The path to the DataFrame.

  • variance (float) – The percentage of variance to be explained. (0.0 - 1.0)

  • pca_path (str) – The path to save the PCA object. If empty, the current working directory is used.

  • verbose (bool) – Whether to print the results.

Returns:

The path to the PCA object.

Return type:

str

Raises:

ValueError – If the variance is not between 0 and 1.