MCPcopy Create free account
hub / github.com/catboost/catboost / TFeaturesTransformer

Class TFeaturesTransformer

library/cpp/linear_regression/linear_regression.h:249–280  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

247};
248
249class TFeaturesTransformer {
250private:
251 ETransformationType TransformationType;
252 TTransformationParameters TransformationParameters;
253
254public:
255 Y_SAVELOAD_DEFINE(TransformationType, TransformationParameters);
256
257 TFeaturesTransformer() = default;
258
259 TFeaturesTransformer(const ETransformationType transformationType,
260 const TTransformationParameters transformationParameters)
261 : TransformationType(transformationType)
262 , TransformationParameters(transformationParameters)
263 {
264 }
265
266 double Transformation(const double value) const {
267 switch (TransformationType) {
268 case ETransformationType::TT_IDENTITY: {
269 return value;
270 }
271 case ETransformationType::TT_SIGMA: {
272 const double valueWithoutOffset = value - TransformationParameters.FeatureOffset;
273 const double transformedValue = valueWithoutOffset / (fabs(valueWithoutOffset) + TransformationParameters.FeatureNormalizer);
274 return TransformationParameters.RegressionIntercept + TransformationParameters.RegressionFactor * transformedValue;
275 }
276 }
277 Y_ASSERT(0);
278 return 0.;
279 }
280};
281
282class TFeaturesTransformerLearner {
283private:

Callers 1

SolveMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected