panann
Public Types | Public Member Functions | Protected Member Functions | List of all members
panann::TrainingData Class Reference

#include <TrainingData.h>

Inheritance diagram for panann::TrainingData:
Inheritance graph
[legend]
Collaboration diagram for panann::TrainingData:
Collaboration graph
[legend]

Public Types

enum  ScalingAlgorithm : uint8_t { ScalingAlgorithm::None = 0, ScalingAlgorithm::Simple, ScalingAlgorithm::StandardDeviation, ScalingAlgorithm::UniformNorm }
 

Public Member Functions

 TrainingData (const TrainingData &)=delete
 
TrainingDataoperator= (const TrainingData &)=delete
 
void SetScalingAlgorithm (ScalingAlgorithm algorithm)
 
ScalingAlgorithm GetScalingAlgorithm () const
 
void SetSimpleScalingNewMin (double val)
 
double GetSimpleScalingNewMin () const
 
void SetSimpleScalingNewMax (double val)
 
double GetSimpleScalingNewMax () const
 
void SetStandardDeviationMultiplier (double val)
 
double GetStandardDeviationMultiplier () const
 
void SetUniformNormMultiplier (double val)
 
double GetUniformNormMultiplier () const
 
void Scale ()
 
void Descale ()
 
void ScaleInput (std::vector< double > *vec) const
 
void ScaleOutput (std::vector< double > *vec) const
 
void DescaleInput (std::vector< double > *vec) const
 
void DescaleOutput (std::vector< double > *vec) const
 
void FromSequentialData (const std::vector< double > &data, size_t input_length)
 

Protected Member Functions

void CalculateMinMax ()
 
void CalculateMean ()
 
void CalculateStdev ()
 
void CalculateUniformNorm ()
 
void ScaleSimple ()
 
void ScaleStandardDeviation ()
 
void ScaleUniformNorm ()
 
void DescaleSimple ()
 
void DescaleStandardDeviation ()
 
void DescaleUniformNorm ()
 

Detailed Description

The TrainingData is just a vector of Examples with some utility functions for scaling that data.

See also
Example

Member Enumeration Documentation

◆ ScalingAlgorithm

Enumerator
None 

Perform no scaling of the Examples.

Simple 

Scale the Examples by calculating a simple factor which will shift the values in the Examples into the range [simple_scaling_new_min_, simple_scaling_new_max_] (which is [-1,1] by default).

See also
SetSimpleScalingNewMin
SetSimpleScalingNewMax
StandardDeviation 

Recenters the Examples around the mean and scales them by a factor of the standard deviation.

See also
SetStandardDeviationMultiplier
UniformNorm 

Recenters the Examples around the mean and scales them by a factor of the uniform norm.

See also
SetUniformNormMultiplier

Member Function Documentation

◆ Descale()

void panann::TrainingData::Descale ( )

Descale the Examples in this TrainingData back to their original values before the data was scaled via Scale().
Uses the selected scaling algorithm.

See also
SetScalingAlgorithm
Scale

◆ DescaleInput()

void panann::TrainingData::DescaleInput ( std::vector< double > *  vec) const

Descale one vector of input.
Uses the scaling parameters calculated during a previous call to Scale.

See also
Scale

◆ DescaleOutput()

void panann::TrainingData::DescaleOutput ( std::vector< double > *  vec) const

Descale one vector of output.
Uses the scaling parameters calculated during a previous call to Scale.

See also
Scale

◆ FromSequentialData()

void panann::TrainingData::FromSequentialData ( const std::vector< double > &  data,
size_t  input_length 
)

Convert sequential data into examples.
Use this to create examples from time series data or other sets of sequential data.
Each example will have |input_length| input samples and one output sample - which will be the value from |data| immediately following those input samples.
We will create as many examples as possible from |data|.

Parameters
input_lengthThe number of input samples to put into each example.
dataAn ordered set of samples. Must have at least input_length elements.

◆ Scale()

void panann::TrainingData::Scale ( )

Scale the Examples in this TrainingData via the selected scaling algorithm.
Use SetScalingAlgorithm to select a scaling algorithm.
The scaling parameters are calculated separately for input and output because these two sets may be in completely different scales.

See also
SetScalingAlgorithm
Descale

◆ ScaleInput()

void panann::TrainingData::ScaleInput ( std::vector< double > *  vec) const

Scale one vector of input.
Uses the scaling parameters calculated during a previous call to Scale.

See also
Scale

◆ ScaleOutput()

void panann::TrainingData::ScaleOutput ( std::vector< double > *  vec) const

Scale one vector of output.
Uses the scaling parameters calculated during a previous call to Scale.

See also
Scale

◆ SetScalingAlgorithm()

void panann::TrainingData::SetScalingAlgorithm ( ScalingAlgorithm  algorithm)

Set the algorithm used to scale Examples in this TrainingData via Scale().
Default: ScalingAlgorithm::Simple

See also
ScalingAlgorithm
Scale

◆ SetSimpleScalingNewMax()

void panann::TrainingData::SetSimpleScalingNewMax ( double  val)

Set the new maximum value used by the simple scaling algorithm.
When using simple scaling, Examples will be scaled to the range [simple_scaling_new_min_, simple_scaling_new_max_].
By default, this range is [-1, 1].

See also
SetSimpleScalingNewMin

◆ SetSimpleScalingNewMin()

void panann::TrainingData::SetSimpleScalingNewMin ( double  val)

Set the new minimum value used by the simple scaling algorithm.
When using simple scaling, Examples will be scaled to the range [simple_scaling_new_min_, simple_scaling_new_max_].
By default, this range is [-1, 1].

See also
SetSimpleScalingNewMax

◆ SetStandardDeviationMultiplier()

void panann::TrainingData::SetStandardDeviationMultiplier ( double  val)

Set the multiplier used by standard deviation scaling algorithm.
After recentering the Examples around their mean, we scale each value by this multiple of the standard deviation.
Default: 2.5

◆ SetUniformNormMultiplier()

void panann::TrainingData::SetUniformNormMultiplier ( double  val)

Set the multiplier used by uniform norm scaling algorithm.
After recentering the Examples around their mean, we scale each value by this multiple of the uniform norm.
Default: 1.0


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