| 141 | }; |
| 142 | |
| 143 | struct TModelTrees { |
| 144 | public: |
| 145 | /** |
| 146 | * This structure stores model runtime data. Should be kept up to date |
| 147 | */ |
| 148 | struct TRuntimeData { |
| 149 | /** |
| 150 | * List of all binary with indexes corresponding to TreeSplits values |
| 151 | */ |
| 152 | TVector<TModelSplit> BinFeatures; |
| 153 | ui32 EffectiveBinFeaturesBucketCount = 0; |
| 154 | }; |
| 155 | |
| 156 | struct TForApplyData { |
| 157 | size_t UsedFloatFeaturesCount = 0; |
| 158 | size_t UsedCatFeaturesCount = 0; |
| 159 | size_t UsedTextFeaturesCount = 0; |
| 160 | size_t UsedEmbeddingFeaturesCount = 0; |
| 161 | size_t UsedEstimatedFeaturesCount = 0; |
| 162 | size_t MinimalSufficientFloatFeaturesVectorSize = 0; |
| 163 | size_t MinimalSufficientCatFeaturesVectorSize = 0; |
| 164 | size_t MinimalSufficientTextFeaturesVectorSize = 0; |
| 165 | size_t MinimalSufficientEmbeddingFeaturesVectorSize = 0; |
| 166 | /** |
| 167 | * List of all TModelCTR used in model |
| 168 | */ |
| 169 | TVector<TModelCtr> UsedModelCtrs; |
| 170 | |
| 171 | //! Offset of first tree leaf in flat tree leafs array |
| 172 | TVector<size_t> TreeFirstLeafOffsets; |
| 173 | |
| 174 | /** |
| 175 | * List all unique CTR bases (feature combination + ctr type) in model |
| 176 | * @return |
| 177 | */ |
| 178 | TVector<TModelCtrBase> GetUsedModelCtrBases() const { |
| 179 | THashSet<TModelCtrBase> ctrsSet; |
| 180 | for (const auto& usedCtr : UsedModelCtrs) { |
| 181 | ctrsSet.insert(usedCtr.Base); |
| 182 | } |
| 183 | TVector<TModelCtrBase> sortedBases(ctrsSet.begin(), ctrsSet.end()); |
| 184 | Sort(sortedBases.begin(), sortedBases.end()); |
| 185 | return sortedBases; |
| 186 | } |
| 187 | }; |
| 188 | |
| 189 | public: |
| 190 | TModelTrees(); |
| 191 | TModelTrees(const TModelTrees& other) { |
| 192 | *this = other; |
| 193 | } |
| 194 | |
| 195 | TModelTrees& operator=(const TModelTrees& other) { |
| 196 | if (this == &other) { |
| 197 | return *this; |
| 198 | } |
| 199 | |
| 200 | std::tie( |