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

Function GetTransformedTarget

catboost/libs/fstr/independent_tree_shap.cpp:506–531  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

504}
505
506static TVector<TVector<double>> GetTransformedTarget(
507 const TVector<TVector<double>>& approx,
508 const TVector<TVector<double>>& targetData,
509 const IMetric& metric
510) {
511 CB_ENSURE_INTERNAL(
512 approx[0].size() == targetData[0].size(),
513 "Approx and target must have same sizes"
514 );
515 TVector<TVector<double>> transformedTarget(approx.size(), TVector<double>(approx[0].size(), 0.0));
516 const bool isMultiTarget = (targetData.size() > 1);
517 for (auto dimension : xrange(approx.size())) {
518 TConstArrayRef<double> targetDataRef = isMultiTarget ? MakeConstArrayRef(targetData[dimension]) : MakeConstArrayRef(targetData[0]);
519 TConstArrayRef<double> approxRef = MakeConstArrayRef(approx[dimension]);
520 TArrayRef<double> transformedTargetRef = MakeArrayRef(transformedTarget[dimension]);
521
522 for (auto documentIdx : xrange(approxRef.size())) {
523 transformedTargetRef[documentIdx] = TransformDocument(
524 metric,
525 targetDataRef[documentIdx],
526 approxRef[documentIdx]
527 );
528 }
529 }
530 return transformedTarget;
531}
532
533void TIndependentTreeShapParams::InitTransformedData(
534 const TFullModel& model,

Callers 1

InitTransformedDataMethod · 0.85

Calls 5

xrangeFunction · 0.85
MakeConstArrayRefFunction · 0.85
MakeArrayRefFunction · 0.85
TransformDocumentFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected