"""Performs a principal component analysis (PCA) on the given data.
classPCA(Algorithm):
"""Performs a principal component analysis (PCA) on the given data.
This algorithm computes a PCA projection (:py:class:`bob.learn.linear.PCATrainer`) on the given training features, projects the features to eigenspace and computes the distance of two projected features in eigenspace.
For example, the eigenface algorithm as proposed by [TP91]_ can be run with this class.
...
...
@@ -29,95 +29,181 @@ class PCA(VanillaBiometricsAlgoritm):
A function taking two parameters and returns a float.
If ``uses_variances`` is set to ``True``, the function is provided with a third parameter, which is the vector of variances (aka. eigenvalues).
svd_solver: std
The way to solve the eigen value problem
is_distance_function : bool
Set this flag to ``False`` if the given ``distance_function`` computes a similarity value (i.e., higher values are better)
factor: float
Multiplication factor used for the scoring stage
use_variances : bool
If set to ``True``, the ``distance_function`` is provided with a third argument, which is the vector of variances (aka. eigenvalues).
kwargs : ``key=value`` pairs
A list of keyword arguments directly passed to the :py:class:`Algorithm` base class constructor.
"""
def__init__(
self,
subspace_dimension,# if int, number of subspace dimensions; if float, percentage of variance to keep
distance_function=euclidean,
svd_solver="auto",
factor=-1,
**kwargs,# parameters directly sent to the base class
):
def__init__(
self,
subspace_dimension,# if int, number of subspace dimensions; if float, percentage of variance to keep