Faiss

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
Public Member Functions | Public Attributes | List of all members
faiss::PCAMatrix Struct Reference

`#include <VectorTransform.h>`

Inheritance diagram for faiss::PCAMatrix:

## Public Member Functions
| PCAMatrix (int d_in=0, int d_out=0, float eigen_power=0, bool random_rotation=false)
virtual void | train (Index::idx_t n, const float *x) override
virtual void | reverse_transform (idx_t n, const float *xt, float *x) const override
void | copy_from (const PCAMatrix &other)
| copy pre-trained PCA matrix
void | prepare_Ab ()
| called after mean, PCAMat and eigenvalues are computed
Public Member Functions inherited from faiss::LinearTransform
| LinearTransform (int d_in=0, int d_out=0, bool have_bias=false)
| both d_in > d_out and d_out < d_in are supported
virtual void | apply_noalloc (idx_t n, const float *x, float *xt) const
| same as apply, but result is pre-allocated
void | transform_transpose (idx_t n, const float *y, float *x) const
const float * | maybe_subsample_train_set (Index::idx_t *n, const float *x)
Public Member Functions inherited from faiss::VectorTransform
| VectorTransform (int d_in=0, int d_out=0)
| ! output dimension
float * | apply (idx_t n, const float *x) const

## Public Attributes
float | eigen_power
bool | random_rotation
| random rotation after PCA
int | balanced_bins
| try to distribute output eigenvectors in this many bins
std::vector< float > | mean
| Mean, size d_in.
std::vector< float > | eigenvalues
| eigenvalues of covariance matrix (= squared singular values)
std::vector< float > | PCAMat
| PCA matrix, size d_in * d_in.
Public Attributes inherited from faiss::LinearTransform
bool | have_bias
std::vector< float > | A
| ! whether to use the bias term More...
std::vector< float > | b
| bias vector, size d_out
size_t | max_points_per_d
bool | verbose
Public Attributes inherited from faiss::VectorTransform
int | d_in
int | d_out
| ! input dimension
bool | is_trained

## Additional Inherited Members
Public Types inherited from faiss::VectorTransform
typedef Index::idx_t | idx_t

## Detailed Description

Applies a principal component analysis on a set of vectors, with optionally whitening and random rotation.

Definition at line 136 of file VectorTransform.h.

## Member Function Documentation

void PCAMatrix::reverse_transform | ( | idx_t | n,
|  | const float * | xt,
|  | float * | x
| ) |  | const
| overridevirtual

reverse transformation. May not be implemented or may return approximate result

Reimplemented from faiss::VectorTransform.

Definition at line 444 of file VectorTransform.cpp.

void PCAMatrix::train | ( | Index::idx_t | n,
|  | const float * | x
| ) |  |
| overridevirtual

Perform training on a representative set of vectors. Does nothing by default.

Parameters

  n | nb of training vectors
  x | training vecors, size n * d

Reimplemented from faiss::VectorTransform.

Definition at line 227 of file VectorTransform.cpp.

## Member Data Documentation

float faiss::PCAMatrix::eigen_power

after transformation the components are multiplied by eigenvalues^eigen_power

=0: no whitening =-2: full whitening

Definition at line 144 of file VectorTransform.h.

The documentation for this struct was generated from the following files:

- /data/users/matthijs/github_faiss/faiss/VectorTransform.h
- /data/users/matthijs/github_faiss/faiss/VectorTransform.cpp