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

Function CalcFeatureEffect

catboost/libs/fstr/calc_fstr.cpp:170–193  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

168}
169
170TVector<std::pair<double, TFeature>> CalcFeatureEffect(
171 const TFullModel& model,
172 const TDataProviderPtr dataset,
173 EFstrType type,
174 NPar::ILocalExecutor* localExecutor,
175 ECalcTypeShapValues calcType)
176{
177 type = AdjustFeatureImportanceType(type, model.GetLossFunctionName());
178 if (type != EFstrType::PredictionValuesChange) {
179 CB_ENSURE_SCALE_IDENTITY(model.GetScaleAndBias(), "feature effect");
180 }
181 if (type == EFstrType::LossFunctionChange) {
182 CB_ENSURE(
183 dataset,
184 "Dataset is not provided for " << EFstrType::LossFunctionChange << ", choose "
185 << EFstrType::PredictionValuesChange << " fstr type explicitly or provide dataset.");
186 return CalcFeatureEffectLossChange(model, dataset, localExecutor, calcType);
187 } else {
188 CB_ENSURE_INTERNAL(
189 type == EFstrType::PredictionValuesChange || type == EFstrType::InternalFeatureImportance,
190 "Inappropriate fstr type " << type);
191 return CalcFeatureEffectAverageChange(model, dataset, localExecutor);
192 }
193}
194
195TVector<TFeatureEffect> CalcRegularFeatureEffect(
196 const TVector<std::pair<double, TFeature>>& internalEffect,

Callers 3

CalcRegularFeatureEffectFunction · 0.85
CalcAndOutputFstrFunction · 0.85
EvaluateFeaturesImplFunction · 0.85

Calls 4

GetLossFunctionNameMethod · 0.80

Tested by

no test coverage detected