| 1843 | |
| 1844 | template <typename TBuilderType> |
| 1845 | static void SumModels( |
| 1846 | const TVector<const TFullModel*>& modelVector, |
| 1847 | const TVector<double>& weights, |
| 1848 | const TVector<TFloatFeature>& floatFeatures, |
| 1849 | const TVector<TCatFeature>& catFeatures, |
| 1850 | bool allModelsHaveLeafWeights, |
| 1851 | ECtrTableMergePolicy ctrMergePolicy, |
| 1852 | TFullModel* sum |
| 1853 | ) { |
| 1854 | const auto approxDimension = modelVector.back()->GetDimensionsCount(); |
| 1855 | TBuilderType builder(floatFeatures, catFeatures, {}, {}, approxDimension); |
| 1856 | |
| 1857 | THashMap<TModelCtrBaseMergeKey, TCtrTablesMergeStatus> ctrTablesIndices; |
| 1858 | |
| 1859 | for (const auto modelId : xrange(modelVector.size())) { |
| 1860 | TScaleAndBias normer = modelVector[modelId]->GetScaleAndBias(); |
| 1861 | StreamModelTreesWithoutScaleAndBiasToBuilder( |
| 1862 | *modelVector[modelId]->ModelTrees, |
| 1863 | weights[modelId] * normer.Scale, |
| 1864 | &builder, |
| 1865 | allModelsHaveLeafWeights, |
| 1866 | ctrMergePolicy, |
| 1867 | &ctrTablesIndices |
| 1868 | ); |
| 1869 | } |
| 1870 | builder.Build(sum->ModelTrees.GetMutable()); |
| 1871 | } |
| 1872 | |
| 1873 | TFullModel SumModels( |
| 1874 | const TVector<const TFullModel*> modelVector, |
no test coverage detected