OTB  9.0.0
Orfeo Toolbox
Classes | Typedefs
otb::sampleAugmentation Namespace Reference

Classes

struct  NeighborSorter
 
struct  NeighborType
 

Typedefs

using SampleType = std::vector< double >
 
using SampleVectorType = std::vector< SampleType >
 
using NNIndicesType = std::vector< NeighborType >
 
using NNVectorType = std::vector< NNIndicesType >
 
SampleType EstimateStds (const SampleVectorType &samples)
 
void ReplicateSamples (const SampleVectorType &inSamples, const vcl_size_t nbSamples, SampleVectorType &newSamples)
 
void JitterSamples (const SampleVectorType &inSamples, const vcl_size_t nbSamples, SampleVectorType &newSamples, float stdFactor=10, const int seed=std::time(nullptr))
 
double ComputeSquareDistance (const SampleType &x, const SampleType &y)
 
void FindKNNIndices (const SampleVectorType &inSamples, const vcl_size_t nbNeighbors, NNVectorType &nnVector)
 
SampleType SmoteCombine (const SampleType &s1, const SampleType &s2, double position)
 
void Smote (const SampleVectorType &inSamples, const vcl_size_t nbSamples, SampleVectorType &newSamples, const int nbNeighbors, const int seed=std::time(nullptr))
 

Typedef Documentation

◆ NNIndicesType

Estimate standard deviations of the components in one pass using Welford's algorithm

Definition at line 164 of file otbSampleAugmentation.h.

◆ NNVectorType

Estimate standard deviations of the components in one pass using Welford's algorithm

Definition at line 165 of file otbSampleAugmentation.h.

◆ SampleType

using otb::sampleAugmentation::SampleType = typedef std::vector<double>

Definition at line 41 of file otbSampleAugmentation.h.

◆ SampleVectorType

Definition at line 42 of file otbSampleAugmentation.h.

Function Documentation

◆ ComputeSquareDistance()

double otb::sampleAugmentation::ComputeSquareDistance ( const SampleType x,
const SampleType y 
)

Estimate standard deviations of the components in one pass using Welford's algorithm

Definition at line 153 of file otbSampleAugmentation.h.

Referenced by FindKNNIndices().

◆ EstimateStds()

SampleType otb::sampleAugmentation::EstimateStds ( const SampleVectorType samples)

Estimate standard deviations of the components in one pass using Welford's algorithm

Definition at line 48 of file otbSampleAugmentation.h.

Referenced by JitterSamples().

◆ FindKNNIndices()

void otb::sampleAugmentation::FindKNNIndices ( const SampleVectorType inSamples,
const vcl_size_t  nbNeighbors,
NNVectorType nnVector 
)

Returns the indices of the nearest neighbors for each input sample

Definition at line 168 of file otbSampleAugmentation.h.

References ComputeSquareDistance().

Referenced by Smote().

◆ JitterSamples()

void otb::sampleAugmentation::JitterSamples ( const SampleVectorType inSamples,
const vcl_size_t  nbSamples,
SampleVectorType newSamples,
float  stdFactor = 10,
const int  seed = std::time(nullptr) 
)

Create new samples by adding noise to existing samples. Gaussian noise is added to randomly selected samples. The standard deviation of the noise added to each component is the same as the one of the input variables divided by stdFactor (defaults to 10). The elements of newSamples are removed before proceeding.

Definition at line 107 of file otbSampleAugmentation.h.

References EstimateStds().

◆ ReplicateSamples()

void otb::sampleAugmentation::ReplicateSamples ( const SampleVectorType inSamples,
const vcl_size_t  nbSamples,
SampleVectorType newSamples 
)

Create new samples by replicating input samples. We loop through the input samples and add them to the new data set until nbSamples are added. The elements of newSamples are removed before proceeding.

Definition at line 84 of file otbSampleAugmentation.h.

◆ Smote()

void otb::sampleAugmentation::Smote ( const SampleVectorType inSamples,
const vcl_size_t  nbSamples,
SampleVectorType newSamples,
const int  nbNeighbors,
const int  seed = std::time(nullptr) 
)

Create new samples using the SMOTE algorithm Chawla, N. V., Bowyer, K. W., Hall, L. O., & Kegelmeyer, W. P., Smote: synthetic minority over-sampling technique, Journal of artificial intelligence research, 16(), 321–357 (2002). http://dx.doi.org/10.1613/jair.953

Definition at line 221 of file otbSampleAugmentation.h.

References FindKNNIndices(), and SmoteCombine().

◆ SmoteCombine()

SampleType otb::sampleAugmentation::SmoteCombine ( const SampleType s1,
const SampleType s2,
double  position 
)

Generate the new sample in the line linking s1 and s2

Definition at line 206 of file otbSampleAugmentation.h.

Referenced by Smote().