| 69 | } |
| 70 | |
| 71 | static THashMap<TFeature, int, TFeatureHash> GetFeatureToIdxMap( |
| 72 | const TFullModel& model, |
| 73 | TVector<TFeature>* features) |
| 74 | { |
| 75 | THashMap<TFeature, int, TFeatureHash> featureToIdx; |
| 76 | const auto& modelBinFeatures = model.ModelTrees->GetBinFeatures(); |
| 77 | int binFeaturesNum = modelBinFeatures.size(); |
| 78 | |
| 79 | for (auto binSplit : model.ModelTrees->GetModelTreeData()->GetTreeSplits()) { |
| 80 | if (binSplit >= binFeaturesNum) { |
| 81 | continue; |
| 82 | } |
| 83 | TFeature feature = GetFeature(model, modelBinFeatures[binSplit]); |
| 84 | if (featureToIdx.contains(feature)) { |
| 85 | continue; |
| 86 | } |
| 87 | int featureIdx = featureToIdx.ysize(); |
| 88 | featureToIdx[feature] = featureIdx; |
| 89 | features->push_back(feature); |
| 90 | } |
| 91 | return featureToIdx; |
| 92 | } |
| 93 | |
| 94 | TVector<std::pair<double, TFeature>> CalcFeatureEffectAverageChange( |
| 95 | const TFullModel& model, |
no test coverage detected