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

Function SimpleFloatModel

catboost/libs/model/ut/lib/model_test_helpers.cpp:186–224  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

184}
185
186TFullModel SimpleFloatModel(size_t treeCount) {
187 TFullModel model;
188 TModelTrees* trees = model.ModelTrees.GetMutable();
189 trees->SetFloatFeatures(
190 {
191 TFloatFeature{
192 false, 0, 0,
193 {}, // bin splits 0, 1
194 ""
195 },
196 TFloatFeature{
197 false, 1, 1,
198 {0.5f}, // bin split 2
199 ""
200 },
201 TFloatFeature{
202 false, 2, 2,
203 {0.5f}, // bin split 3
204 ""
205 }
206 }
207 );
208 for (auto i : xrange(301)) {
209 trees->AddFloatFeatureBorder(0, -298.0f + i);
210 }
211 {
212 double tenPower = 1.0;
213 for (size_t treeIndex = 0; treeIndex < treeCount; ++treeIndex) {
214 TVector<int> tree = {300, 301, 302};
215 trees->AddBinTree(tree);
216 for (int leafIndex = 0; leafIndex < 8; ++leafIndex) {
217 trees->AddLeafValue(leafIndex * tenPower);
218 }
219 tenPower *= 10.0;
220 }
221 }
222 model.UpdateDynamicData();
223 return model;
224}
225
226TFullModel SimpleTextModel(
227 TIntrusivePtr<TTextProcessingCollection> textCollection,

Callers 4

Y_UNIT_TESTFunction · 0.85
Y_UNIT_TESTFunction · 0.85
Y_UNIT_TESTFunction · 0.85
Y_UNIT_TESTFunction · 0.85

Calls 7

xrangeFunction · 0.85
GetMutableMethod · 0.80
SetFloatFeaturesMethod · 0.80
AddFloatFeatureBorderMethod · 0.80
AddBinTreeMethod · 0.80
AddLeafValueMethod · 0.80
UpdateDynamicDataMethod · 0.80

Tested by

no test coverage detected