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

Function GetPairsSubset

catboost/libs/data/target.cpp:534–557  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

532}
533
534static TFlatPairsInfo GetPairsSubset(
535 TConstArrayRef<TPair> pairs,
536 const TObjectsGrouping& objectsGrouping,
537 const TObjectsGroupingSubset& objectsGroupingSubset
538) {
539 TVector<TMaybe<ui32>> srcToDstObjectIndices(objectsGrouping.GetObjectCount());
540 objectsGroupingSubset.GetObjectsIndexing().ForEach(
541 [&srcToDstObjectIndices] (ui32 idx, ui32 srcIdx) { srcToDstObjectIndices[srcIdx] = idx; }
542 );
543
544 TFlatPairsInfo result;
545 for (const auto& pair : pairs) {
546 const auto& maybeDstWinnerId = srcToDstObjectIndices[pair.WinnerId];
547 if (!maybeDstWinnerId) {
548 continue;
549 }
550 const auto& maybeDstLoserId = srcToDstObjectIndices[pair.LoserId];
551 if (!maybeDstLoserId) {
552 continue;
553 }
554 result.emplace_back(*maybeDstWinnerId, *maybeDstLoserId, pair.Weight);
555 }
556 return result;
557}
558
559
560struct TSrcToDstGroupMap {

Callers 1

GetSubsetMethod · 0.85

Calls 11

xrangeFunction · 0.85
GetSubsetGroupingMethod · 0.80
GetGroupMethod · 0.80
moveFunction · 0.50
visitFunction · 0.50
GetObjectCountMethod · 0.45
ForEachMethod · 0.45
emplace_backMethod · 0.45
resizeMethod · 0.45
GetSizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected