#include <VectorTransform.h>
Public Member Functions | |
PCAMatrix (int d_in=0, int d_out=0, float eigen_power=0, bool random_rotation=false) | |
void | train (Index::idx_t n, const float *x) override |
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 | |
![]() | |
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 | |
void | apply_noalloc (idx_t n, const float *x, float *xt) const override |
same as apply, but result is pre-allocated | |
void | transform_transpose (idx_t n, const float *y, float *x) const |
![]() | |
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 | |
size_t | max_points_per_d |
ratio between # training vectors and dimension | |
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. | |
![]() | |
bool | have_bias |
std::vector< float > | A |
! whether to use the bias term More... | |
std::vector< float > | b |
bias vector, size d_out | |
bool | verbose |
![]() | |
int | d_in |
int | d_out |
! input dimension | |
bool | is_trained |
Additional Inherited Members | |
![]() | |
typedef Index::idx_t | idx_t |
Applies a principal component analysis on a set of vectors, with optionally whitening and random rotation.
Definition at line 124 of file VectorTransform.h.
|
overridevirtual |
reverse transformation. May not be implemented or may return approximate result
Reimplemented from faiss::VectorTransform.
Definition at line 521 of file VectorTransform.cpp.
|
overridevirtual |
train on n vectors. If n < d_in then the eigenvector matrix will be completed with 0s
Reimplemented from faiss::VectorTransform.
Definition at line 271 of file VectorTransform.cpp.
float faiss::PCAMatrix::eigen_power |
after transformation the components are multiplied by eigenvalues^eigen_power
=0: no whitening =-2: full whitening
Definition at line 132 of file VectorTransform.h.