dignea  1.0.0
Diverse Instance Generator with Novelty Search and Evolutionary Algorithms
PCA.h File Reference
#include <vector>
#include "NumCpp.hpp"

Go to the source code of this file.

Functions

nc::NdArray< float > PCA::scale (const nc::NdArray< float > &sample)
 Scales the features using a pre-built StandardScaler. More...
 
nc::NdArray< float > PCA::scale (const nc::NdArray< float > &samples, nc::NdArray< float > &extMean, nc::NdArray< float > &extScale)
 Scales the features using a pre-built StandardScaler. This version is for a batch of samples. More...
 
nc::NdArray< float > PCA::transform (const nc::NdArray< float > &sample)
 Transforms the sample using a PCA model previously built. More...
 
nc::NdArray< float > PCA::transform (const nc::NdArray< float > &samples, const nc::NdArray< float > &extMean)
 Transforms the sample using a PCA model previously built. This version is for a batch of samples. More...
 
nc::NdArray< float > PCA::PCA (const std::vector< float > &sample)
 Applies the pipeline Standard Scaler plus PCA to the sample data. More...
 
nc::NdArray< float > PCA::PCA (const nc::NdArray< float > &sample)
 Applies the pipeline Standard Scaler plus PCA to the sample data. More...
 
nc::NdArray< float > PCA::PCABatch (const nc::NdArray< float > &samples)
 Applies the pipeline Standard Scaler plus PCA to the batch of samples. More...
 

Variables

nc::NdArray< float > PCA::componentsT
 This is the PCA components.T we obtained when using 5000 samples and considering only the 8-dimensional features space. HERE WE DO NOT USE THE INSTANCE DATA TO CREATE THE PCA and we ensure a balanced distribution of the targets. More...
 
nc::NdArray< float > PCA::mean
 This is the PCA mean we obtained using only 5000 samples and considering only the 8-dimensional features space. HERE WE DO NOT USE THE INSTANCE DATA TO CREATE THE PCA and we ensure a balanced distribution of the targets. More...
 
nc::NdArray< float > PCA::scaler_mean
 This is the scaler mean we obtained using only 5000 samples and considering only the 8-dimensional features space. HERE WE DO NOT USE THE INSTANCE DATA TO CREATE THE PCA. More...
 
nc::NdArray< float > PCA::scaler_scale
 This is the scaler scale obtained with only 5000 samples and considering only the 8-dimensional features space. HERE WE DO NOT USE THE INSTANCE DATA TO CREATE THE PCA. More...
 

Detailed Description

Author
Alejandro Marrero (amarr.nosp@m.erd@.nosp@m.ull.e.nosp@m.du.e.nosp@m.s)
Version
0.1
Date
2022-10-21

Function Documentation

◆ PCA() [1/2]

nc::NdArray<float> PCA::PCA ( const nc::NdArray< float > &  sample)

Applies the pipeline Standard Scaler plus PCA to the sample data.

Parameters
samples
Returns
nc::NdArray<float>

◆ PCA() [2/2]

nc::NdArray<float> PCA::PCA ( const std::vector< float > &  sample)

Applies the pipeline Standard Scaler plus PCA to the sample data.

Parameters
samples
Returns
nc::NdArray<float>

◆ PCABatch()

nc::NdArray<float> PCA::PCABatch ( const nc::NdArray< float > &  samples)

Applies the pipeline Standard Scaler plus PCA to the batch of samples.

Parameters
samples
Returns
nc::NdArray<float>

◆ scale() [1/2]

nc::NdArray<float> PCA::scale ( const nc::NdArray< float > &  sample)

Scales the features using a pre-built StandardScaler.

Parameters
sample
Returns
nc::NdArray<float>

◆ scale() [2/2]

nc::NdArray<float> PCA::scale ( const nc::NdArray< float > &  samples,
nc::NdArray< float > &  extMean,
nc::NdArray< float > &  extScale 
)

Scales the features using a pre-built StandardScaler. This version is for a batch of samples.

Parameters
samples
extMean
extScale
Returns
nc::NdArray<float>

◆ transform() [1/2]

nc::NdArray<float> PCA::transform ( const nc::NdArray< float > &  sample)

Transforms the sample using a PCA model previously built.

Parameters
sample
Returns
nc::NdArray<float>

◆ transform() [2/2]

nc::NdArray<float> PCA::transform ( const nc::NdArray< float > &  samples,
const nc::NdArray< float > &  extMean 
)

Transforms the sample using a PCA model previously built. This version is for a batch of samples.

Parameters
samples
extMean
Returns
nc::NdArray<float>

Variable Documentation

◆ componentsT

nc::NdArray<float> PCA::componentsT
Initial value:
= {
{7.375311811592301370e-02, -3.178655266058625917e-01},
{4.093087483174921992e-01, 4.955981249916805442e-01},
{3.346693276473038936e-01, -6.128877541751576175e-01},
{5.953059210206299579e-01, 1.328377255939875989e-01},
{-5.162302414308733711e-02, -4.926638878583582404e-01},
{5.983052657524839946e-01, -1.317157490269994513e-01},
}

This is the PCA components.T we obtained when using 5000 samples and considering only the 8-dimensional features space. HERE WE DO NOT USE THE INSTANCE DATA TO CREATE THE PCA and we ensure a balanced distribution of the targets.

◆ mean

nc::NdArray<float> PCA::mean
Initial value:
= {
-1.302661682226850347e-16, 5.921189464667501929e-18,
-2.107943449421630714e-15, 9.577523959099684045e-16,
5.329070518200751197e-17, -3.907985046680551042e-16,
}

This is the PCA mean we obtained using only 5000 samples and considering only the 8-dimensional features space. HERE WE DO NOT USE THE INSTANCE DATA TO CREATE THE PCA and we ensure a balanced distribution of the targets.

◆ scaler_mean

nc::NdArray<float> PCA::scaler_mean
Initial value:
= {
1.079515125000000080e+04, 2.652374999999999972e+01,
2.904959681383768952e+02, 5.040460461552937659e+02,
1.784837500024586854e+00, 9.787104166666666742e+02,
}

This is the scaler mean we obtained using only 5000 samples and considering only the 8-dimensional features space. HERE WE DO NOT USE THE INSTANCE DATA TO CREATE THE PCA.

◆ scaler_scale

nc::NdArray<float> PCA::scaler_scale
Initial value:
= {
6.728206620826987091e+03, 2.899059219708179924e+01,
1.302756303387655201e+01, 2.544038827736384079e+01,
1.753588622119440776e+00, 1.909781553371280793e+01,
}

This is the scaler scale obtained with only 5000 samples and considering only the 8-dimensional features space. HERE WE DO NOT USE THE INSTANCE DATA TO CREATE THE PCA.