panann
|
#include <TrainingData.h>
Public Types | |
enum | ScalingAlgorithm : uint8_t { ScalingAlgorithm::None = 0, ScalingAlgorithm::Simple, ScalingAlgorithm::StandardDeviation, ScalingAlgorithm::UniformNorm } |
Public Member Functions | |
TrainingData (const TrainingData &)=delete | |
TrainingData & | operator= (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) |
The TrainingData is just a vector of Examples with some utility functions for scaling that data.
|
strong |
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). |
StandardDeviation | Recenters the Examples around the mean and scales them by a factor of the standard deviation.
|
UniformNorm | Recenters the Examples around the mean and scales them by a factor of the uniform norm.
|
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.
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.
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.
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|.
input_length | The number of input samples to put into each example. |
data | An ordered set of samples. Must have at least input_length elements. |
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.
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.
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.
void panann::TrainingData::SetScalingAlgorithm | ( | ScalingAlgorithm | algorithm | ) |
Set the algorithm used to scale Examples in this TrainingData via Scale().
Default: ScalingAlgorithm::Simple
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].
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].
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
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