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

Function Test

catboost/libs/data/ut/quantization_ut.cpp:44–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42 }
43
44 void Test(std::function<TTestCase(bool)>&& generateTestCase) {
45 for (auto quantizationOptions : {
46 TQuantizationOptions{true, false},
47 TQuantizationOptions{false, true},
48 TQuantizationOptions{true, true}
49 })
50 {
51 quantizationOptions.MaxSubsetSizeForBuildBordersAlgorithms = 7;
52
53 TVector<bool> bundleExclusiveFeaturesVariants = {false};
54
55 TVector<bool> packBinaryFeaturesVariants = {false, true};
56
57 for (auto packBinaryFeatures : packBinaryFeaturesVariants) {
58 quantizationOptions.PackBinaryFeaturesForCpu = packBinaryFeatures;
59
60 for (auto bundleExclusiveFeatures : bundleExclusiveFeaturesVariants) {
61 quantizationOptions.BundleExclusiveFeatures = bundleExclusiveFeatures;
62
63 for (auto clearSrcData : {false, true}) {
64 TTestCase testCase = generateTestCase(packBinaryFeatures);
65
66 TRestorableFastRng64 rand(0);
67
68 NPar::TLocalExecutor localExecutor;
69 //localExecutor.RunAdditionalThreads(3);
70
71 TRawDataProviderPtr rawDataProvider = MakeDataProvider<TRawObjectsDataProvider>(
72 Nothing(),
73 std::move(testCase.SrcData),
74 false,
75 /*forceUnitAutoPairWeights*/ false,
76 &localExecutor
77 );
78
79 TDataProviderPtr quantizedDataProvider = Quantize(
80 quantizationOptions,
81 clearSrcData ? std::move(rawDataProvider) : rawDataProvider,
82 testCase.QuantizedFeaturesInfo,
83 &rand,
84 &localExecutor)->CastMoveTo<TObjectsDataProvider>();
85
86 Compare<TQuantizedObjectsDataProvider>(
87 std::move(quantizedDataProvider),
88 testCase.ExpectedData
89 );
90 }
91 }
92 }
93 }
94 }
95
96
97 Y_UNIT_TEST(TestFloatFeatures) {

Callers 1

Y_UNIT_TESTFunction · 0.70

Calls 3

NothingFunction · 0.85
moveFunction · 0.50
QuantizeFunction · 0.50

Tested by

no test coverage detected