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

Method Init

catboost/libs/dataset_statistics/statistics_data_structures.cpp:160–181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

158}
159
160void TTargetsStatistics::Init(const TDataMetaInfo& metaInfo, const TFeatureCustomBorders& customBorders) {
161 TargetType = metaInfo.TargetType;
162 TargetCount = metaInfo.TargetCount;
163 switch (TargetType) {
164 case ERawTargetType::Float:
165 FloatTargetStatistics.resize(TargetCount);
166 break;
167 case ERawTargetType::Boolean:
168 case ERawTargetType::Integer:
169 case ERawTargetType::String:
170 DiscreteTargetStatistics.resize(TargetCount);
171 for (ui32 i = 0; i < TargetCount; ++i) {
172 DiscreteTargetStatistics[i].TargetType = TargetType;
173 }
174 break;
175 default:
176 CB_ENSURE(TargetType == ERawTargetType::None, "Unexpected target type " << TargetType << ", expected 'None'");
177 CATBOOST_DEBUG_LOG << "No target was found for Target statistics\n";
178 break;
179 }
180 SetCustomBorders(customBorders, &FloatTargetStatistics);
181}
182
183void TTargetsStatistics::Update(ui32 flatTargetIdx, TStringBuf value) {
184 DiscreteTargetStatistics[flatTargetIdx].Update(value);

Callers 2

StartMethod · 0.45
Y_UNIT_TESTFunction · 0.45

Calls 5

SetCustomBordersFunction · 0.85
GetCatFeatureCountMethod · 0.80
resizeMethod · 0.45
GetFloatFeatureCountMethod · 0.45
GetTextFeatureCountMethod · 0.45

Tested by

no test coverage detected