| 674 | } |
| 675 | |
| 676 | TVector<ui32> TModelTrees::GetTreeLeafCounts() const { |
| 677 | auto applyData = GetApplyData(); |
| 678 | const auto& firstLeafOfsets = applyData->TreeFirstLeafOffsets; |
| 679 | Y_ASSERT(IsSorted(firstLeafOfsets.begin(), firstLeafOfsets.end())); |
| 680 | TVector<ui32> treeLeafCounts; |
| 681 | treeLeafCounts.reserve(GetTreeCount()); |
| 682 | for (size_t treeNum = 0; treeNum < GetTreeCount(); ++treeNum) { |
| 683 | const size_t currTreeLeafValuesEnd = ( |
| 684 | treeNum + 1 < GetTreeCount() |
| 685 | ? firstLeafOfsets[treeNum + 1] |
| 686 | : GetModelTreeData()->GetLeafValues().size() |
| 687 | ); |
| 688 | const size_t currTreeLeafValuesCount = currTreeLeafValuesEnd - firstLeafOfsets[treeNum]; |
| 689 | Y_ASSERT(currTreeLeafValuesCount % ApproxDimension == 0); |
| 690 | treeLeafCounts.push_back(currTreeLeafValuesCount / ApproxDimension); |
| 691 | } |
| 692 | return treeLeafCounts; |
| 693 | } |
| 694 | |
| 695 | void TModelTrees::SetScaleAndBias(const TScaleAndBias& scaleAndBias) { |
| 696 | CB_ENSURE(IsValidFloat(scaleAndBias.Scale), "Invalid scale " << scaleAndBias.Scale); |
no test coverage detected