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

Function SwapFeatureAndDocumentAxes

catboost/libs/fstr/shap_values.cpp:1514–1529  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1512}
1513
1514static TVector<TVector<TVector<double>>> SwapFeatureAndDocumentAxes(const TVector<TVector<TVector<double>>>& shapValues) {
1515 const size_t approxDimension = shapValues[0].size();
1516 const size_t documentCount = shapValues.size();
1517 const size_t featuresCount = shapValues[0][0].size();
1518 TVector<TVector<TVector<double>>> swapedShapValues(featuresCount);
1519 for (size_t featureIdx = 0; featureIdx < featuresCount; ++featureIdx) {
1520 swapedShapValues[featureIdx].resize(approxDimension);
1521 for (size_t dimension = 0; dimension < approxDimension; ++dimension) {
1522 swapedShapValues[featureIdx][dimension].resize(documentCount);
1523 for (size_t documentIdx = 0; documentIdx < documentCount; ++documentIdx) {
1524 swapedShapValues[featureIdx][dimension][documentIdx] = shapValues[documentIdx][dimension][featureIdx];
1525 }
1526 }
1527 }
1528 return swapedShapValues;
1529}
1530
1531// returned: ShapValues[featureIdx][dim][documentIdx]
1532TVector<TVector<TVector<double>>> CalcShapValueWithQuantizedData(

Callers 1

Calls 2

sizeMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected