diff options
author | yazevnul <yazevnul@yandex-team.ru> | 2022-02-10 16:46:46 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:46 +0300 |
commit | 8cbc307de0221f84c80c42dcbe07d40727537e2c (patch) | |
tree | 625d5a673015d1df891e051033e9fcde5c7be4e5 /library/cpp/linear_regression | |
parent | 30d1ef3941e0dc835be7609de5ebee66958f215a (diff) | |
download | ydb-8cbc307de0221f84c80c42dcbe07d40727537e2c.tar.gz |
Restoring authorship annotation for <yazevnul@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/linear_regression')
-rw-r--r-- | library/cpp/linear_regression/linear_regression.h | 10 | ||||
-rw-r--r-- | library/cpp/linear_regression/linear_regression_ut.cpp | 30 | ||||
-rw-r--r-- | library/cpp/linear_regression/welford.h | 6 |
3 files changed, 23 insertions, 23 deletions
diff --git a/library/cpp/linear_regression/linear_regression.h b/library/cpp/linear_regression/linear_regression.h index e57de5ff6c..20b3ae1e53 100644 --- a/library/cpp/linear_regression/linear_regression.h +++ b/library/cpp/linear_regression/linear_regression.h @@ -146,12 +146,12 @@ public: bool Add(const double* featuresBegin, const double* featuresEnd, const double* goalsBegin, const double* weightsBegin); bool Add(const TVector<double>& features, const TVector<double>& goals) { - Y_ASSERT(features.size() == goals.size()); + Y_ASSERT(features.size() == goals.size()); return Add(features.data(), features.data() + features.size(), goals.data()); } bool Add(const TVector<double>& features, const TVector<double>& goals, const TVector<double>& weights) { - Y_ASSERT(features.size() == goals.size() && features.size() == weights.size()); + Y_ASSERT(features.size() == goals.size() && features.size() == weights.size()); return Add(features.data(), features.data() + features.size(), goals.data(), weights.data()); } @@ -239,7 +239,7 @@ struct TTransformationParameters { double FeatureOffset = 0.; double FeatureNormalizer = 1.; - Y_SAVELOAD_DEFINE(RegressionFactor, + Y_SAVELOAD_DEFINE(RegressionFactor, RegressionIntercept, FeatureOffset, FeatureNormalizer); @@ -251,7 +251,7 @@ private: TTransformationParameters TransformationParameters; public: - Y_SAVELOAD_DEFINE(TransformationType, TransformationParameters); + Y_SAVELOAD_DEFINE(TransformationType, TransformationParameters); TFeaturesTransformer() = default; @@ -273,7 +273,7 @@ public: return TransformationParameters.RegressionIntercept + TransformationParameters.RegressionFactor * transformedValue; } } - Y_ASSERT(0); + Y_ASSERT(0); return 0.; } }; diff --git a/library/cpp/linear_regression/linear_regression_ut.cpp b/library/cpp/linear_regression/linear_regression_ut.cpp index e71a16b67a..991a95c0d0 100644 --- a/library/cpp/linear_regression/linear_regression_ut.cpp +++ b/library/cpp/linear_regression/linear_regression_ut.cpp @@ -13,8 +13,8 @@ namespace { } } -Y_UNIT_TEST_SUITE(TLinearRegressionTest) { - Y_UNIT_TEST(MeanAndDeviationTest) { +Y_UNIT_TEST_SUITE(TLinearRegressionTest) { + Y_UNIT_TEST(MeanAndDeviationTest) { TVector<double> arguments; TVector<double> weights; @@ -77,7 +77,7 @@ Y_UNIT_TEST_SUITE(TLinearRegressionTest) { ValueIsCorrect(deviationCalculator.GetDeviation(), checkRemovingDeviationCalculator.GetDeviation(), 1e-5); } - Y_UNIT_TEST(CovariationTest) { + Y_UNIT_TEST(CovariationTest) { TVector<double> firstValues; TVector<double> secondValues; TVector<double> weights; @@ -176,15 +176,15 @@ Y_UNIT_TEST_SUITE(TLinearRegressionTest) { } } - Y_UNIT_TEST(FastSLRTest) { + Y_UNIT_TEST(FastSLRTest) { SLRTest<TFastSLRSolver>(); } - Y_UNIT_TEST(KahanSLRTest) { + Y_UNIT_TEST(KahanSLRTest) { SLRTest<TKahanSLRSolver>(); } - Y_UNIT_TEST(SLRTest) { + Y_UNIT_TEST(SLRTest) { SLRTest<TSLRSolver>(); } @@ -231,11 +231,11 @@ Y_UNIT_TEST_SUITE(TLinearRegressionTest) { UNIT_ASSERT_DOUBLES_EQUAL(lrSolver.SumSquaredErrors(), expectedSumSquaredErrors, expectedSumSquaredErrors * 0.01); } - Y_UNIT_TEST(FastLRTest) { + Y_UNIT_TEST(FastLRTest) { LinearRegressionTest<TFastLinearRegressionSolver>(); } - Y_UNIT_TEST(LRTest) { + Y_UNIT_TEST(LRTest) { LinearRegressionTest<TLinearRegressionSolver>(); } @@ -275,31 +275,31 @@ Y_UNIT_TEST_SUITE(TLinearRegressionTest) { UNIT_ASSERT_DOUBLES_EQUAL(rmse, 0., 1e-3); } - Y_UNIT_TEST(SigmaTest100) { + Y_UNIT_TEST(SigmaTest100) { TransformationTest(ETransformationType::TT_SIGMA, 100); } - Y_UNIT_TEST(SigmaTest1000) { + Y_UNIT_TEST(SigmaTest1000) { TransformationTest(ETransformationType::TT_SIGMA, 1000); } - Y_UNIT_TEST(SigmaTest10000) { + Y_UNIT_TEST(SigmaTest10000) { TransformationTest(ETransformationType::TT_SIGMA, 10000); } - Y_UNIT_TEST(SigmaTest100000) { + Y_UNIT_TEST(SigmaTest100000) { TransformationTest(ETransformationType::TT_SIGMA, 100000); } - Y_UNIT_TEST(SigmaTest1000000) { + Y_UNIT_TEST(SigmaTest1000000) { TransformationTest(ETransformationType::TT_SIGMA, 1000000); } - Y_UNIT_TEST(SigmaTest10000000) { + Y_UNIT_TEST(SigmaTest10000000) { TransformationTest(ETransformationType::TT_SIGMA, 10000000); } - Y_UNIT_TEST(ResetCalculatorTest) { + Y_UNIT_TEST(ResetCalculatorTest) { TVector<double> arguments; TVector<double> weights; const double eps = 1e-10; diff --git a/library/cpp/linear_regression/welford.h b/library/cpp/linear_regression/welford.h index ee865d6693..a39800974c 100644 --- a/library/cpp/linear_regression/welford.h +++ b/library/cpp/linear_regression/welford.h @@ -11,7 +11,7 @@ private: TKahanAccumulator<double> SumWeights; public: - Y_SAVELOAD_DEFINE(Mean, SumWeights); + Y_SAVELOAD_DEFINE(Mean, SumWeights); void Multiply(const double value); void Add(const double value, const double weight = 1.); @@ -40,7 +40,7 @@ private: TKahanAccumulator<double> SumWeights; public: - Y_SAVELOAD_DEFINE(Covariation, FirstValueMean, SecondValueMean, SumWeights); + Y_SAVELOAD_DEFINE(Covariation, FirstValueMean, SecondValueMean, SumWeights); void Add(const double firstValue, const double secondValue, const double weight = 1.); void Remove(const double firstValue, const double secondValue, const double weight = 1.); @@ -62,7 +62,7 @@ private: TMeanCalculator MeanCalculator; public: - Y_SAVELOAD_DEFINE(Deviation, MeanCalculator); + Y_SAVELOAD_DEFINE(Deviation, MeanCalculator); void Add(const double value, const double weight = 1.); void Remove(const double value, const double weight = 1.); |