13 #ifndef MLPACK_CORE_DATA_SCALING_MODEL_IMPL_HPP 14 #define MLPACK_CORE_DATA_SCALING_MODEL_IMPL_HPP 24 double epsilonvalue) :
41 scalerType(other.scalerType),
42 minmaxscale(other.minmaxscale == NULL ? NULL :
44 maxabsscale(other.maxabsscale == NULL ? NULL :
46 meanscale(other.meanscale == NULL ? NULL :
48 standardscale(other.standardscale == NULL ? NULL :
50 pcascale(other.pcascale == NULL ? NULL :
52 zcascale(other.zcascale == NULL ? NULL :
54 minValue(other.minValue),
55 maxValue(other.maxValue),
56 epsilon(other.epsilon)
63 scalerType(other.scalerType),
64 minmaxscale(other.minmaxscale),
65 maxabsscale(other.maxabsscale),
66 meanscale(other.meanscale),
67 standardscale(other.standardscale),
68 pcascale(other.pcascale),
69 zcascale(other.zcascale),
70 minValue(other.minValue),
71 maxValue(other.maxValue),
72 epsilon(other.epsilon)
75 other.minmaxscale = NULL;
76 other.maxabsscale = NULL;
77 other.meanscale = NULL;
78 other.standardscale = NULL;
79 other.pcascale = NULL;
80 other.zcascale = NULL;
83 other.epsilon = 0.00005;
93 scalerType = other.scalerType;
96 minmaxscale = (other.minmaxscale == NULL) ? NULL :
100 maxabsscale = (other.maxabsscale == NULL) ? NULL :
103 delete standardscale;
104 standardscale = (other.standardscale == NULL) ? NULL :
108 meanscale = (other.meanscale == NULL) ? NULL :
112 pcascale = (other.pcascale == NULL) ? NULL :
116 zcascale = (other.zcascale == NULL) ? NULL :
119 minValue = other.minValue;
120 maxValue = other.maxValue;
121 epsilon = other.epsilon;
131 scalerType = other.scalerType;
132 minmaxscale = other.minmaxscale;
133 maxabsscale = other.maxabsscale;
134 meanscale = other.meanscale;
135 standardscale = other.standardscale;
136 pcascale = other.pcascale;
137 zcascale = other.zcascale;
138 minValue = other.minValue;
139 maxValue = other.maxValue;
140 epsilon = other.epsilon;
142 other.scalerType = 0;
143 other.minmaxscale =
nullptr;
144 other.maxabsscale =
nullptr;
145 other.meanscale =
nullptr;
146 other.standardscale =
nullptr;
147 other.pcascale =
nullptr;
148 other.zcascale =
nullptr;
151 other.epsilon = 0.00005;
160 delete standardscale;
166 template<
typename MatType>
167 void ScalingModel::Fit(
const MatType& input)
169 if (scalerType == ScalerTypes::STANDARD_SCALER)
171 delete standardscale;
173 standardscale->
Fit(input);
175 else if (scalerType == ScalerTypes::MIN_MAX_SCALER)
179 minmaxscale->
Fit(input);
181 else if (scalerType == ScalerTypes::MEAN_NORMALIZATION)
185 meanscale->
Fit(input);
187 else if (scalerType == ScalerTypes::MAX_ABS_SCALER)
191 maxabsscale->
Fit(input);
193 else if (scalerType == ScalerTypes::PCA_WHITENING)
197 pcascale->
Fit(input);
199 else if (scalerType == ScalerTypes::ZCA_WHITENING)
203 zcascale->
Fit(input);
207 template<
typename MatType>
210 if (scalerType == ScalerTypes::STANDARD_SCALER)
214 else if (scalerType == ScalerTypes::MIN_MAX_SCALER)
218 else if (scalerType == ScalerTypes::MEAN_NORMALIZATION)
222 else if (scalerType == ScalerTypes::MAX_ABS_SCALER)
226 else if (scalerType == ScalerTypes::PCA_WHITENING)
230 else if (scalerType == ScalerTypes::ZCA_WHITENING)
236 template<
typename MatType>
237 void ScalingModel::InverseTransform(
const MatType& input, MatType& output)
239 if (scalerType == ScalerTypes::STANDARD_SCALER)
243 else if (scalerType == ScalerTypes::MIN_MAX_SCALER)
247 else if (scalerType == ScalerTypes::MEAN_NORMALIZATION)
251 else if (scalerType == ScalerTypes::MAX_ABS_SCALER)
255 else if (scalerType == ScalerTypes::PCA_WHITENING)
259 else if (scalerType == ScalerTypes::ZCA_WHITENING)
void Fit(const MatType &input)
Function to fit features, to find out the min max and scale.
Definition: max_abs_scaler.hpp:55
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
void Fit(const MatType &input)
Function to fit features, to find out the min max and scale.
Definition: zca_whitening.hpp:63
void InverseTransform(const MatType &input, MatType &output)
Function to retrieve original dataset.
Definition: pca_whitening.hpp:107
void InverseTransform(const MatType &input, MatType &output)
Function to retrieve original dataset.
Definition: mean_normalization.hpp:91
A simple Mean Normalization class.
Definition: mean_normalization.hpp:46
~ScalingModel()
Clean up memory.
Definition: scaling_model_impl.hpp:156
void Fit(const MatType &input)
Function to fit features, to find out the min max and scale.
Definition: min_max_scaler.hpp:74
ScalingModel(const int minvalue=0, const int maxvalue=1, double epsilonvalue=0.00005)
Create an object.
Definition: scaling_model_impl.hpp:22
ScalingModel & operator=(const ScalingModel &other)
Copy assignment operator.
Definition: scaling_model_impl.hpp:87
void InverseTransform(const MatType &input, MatType &output)
Function to retrieve original dataset.
Definition: standard_scaler.hpp:90
void InverseTransform(const MatType &input, MatType &output)
Function to retrieve original dataset.
Definition: max_abs_scaler.hpp:90
void Fit(const MatType &input)
Function to fit features, to find out the min max and scale.
Definition: standard_scaler.hpp:56
A simple PCAWhitening class.
Definition: pca_whitening.hpp:47
void Transform(const MatType &input, MatType &output)
Transform to scale features.
Definition: scaling_model_impl.hpp:208
void Transform(const MatType &input, MatType &output)
Function for ZCA whitening.
Definition: zca_whitening.hpp:75
void Transform(const MatType &input, MatType &output)
Function to scale features.
Definition: standard_scaler.hpp:72
The model to save to disk.
Definition: scaling_model.hpp:29
A simple MaxAbs Scaler class.
Definition: max_abs_scaler.hpp:46
void Transform(const MatType &input, MatType &output)
Function to scale features.
Definition: mean_normalization.hpp:73
void Fit(const MatType &input)
Function to fit features, to find out the min max and scale.
Definition: pca_whitening.hpp:71
A simple Standard Scaler class.
Definition: standard_scaler.hpp:47
void Transform(const MatType &input, MatType &output)
Function to scale features.
Definition: max_abs_scaler.hpp:72
void Transform(const MatType &input, MatType &output)
Function for PCA whitening.
Definition: pca_whitening.hpp:87
void InverseTransform(const MatType &input, MatType &output)
Function to retrieve original dataset.
Definition: zca_whitening.hpp:88
A simple MinMax Scaler class.
Definition: min_max_scaler.hpp:48
void Transform(const MatType &input, MatType &output)
Function to scale features.
Definition: min_max_scaler.hpp:95
void InverseTransform(const MatType &input, MatType &output)
Function to retrieve original dataset.
Definition: min_max_scaler.hpp:113
A simple ZCAWhitening class.
Definition: zca_whitening.hpp:47
void Fit(const MatType &input)
Function to fit features, to find out the min max and scale.
Definition: mean_normalization.hpp:55