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

Function GetSubset

catboost/libs/helpers/array_subset.h:960–983  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

958
959 template <class TDst, class TSrcArrayLike, class TSize=size_t>
960 inline TVector<TDst> GetSubset(
961 const TSrcArrayLike& srcArrayLike,
962 const TArraySubsetIndexing<TSize>& subsetIndexing,
963 TMaybe<NPar::ILocalExecutor*> localExecutor = Nothing(), // use parallel implementation if defined
964 TMaybe<TSize> approximateBlockSize = Nothing() // for parallel version
965 ) {
966 TVector<TDst> dst;
967 dst.yresize(subsetIndexing.Size());
968
969 TArraySubset<const TSrcArrayLike, TSize> arraySubset(&srcArrayLike, &subsetIndexing);
970 if (localExecutor.Defined()) {
971 arraySubset.ParallelForEach(
972 [&dst](TSize idx, TDst srcElement) { dst[idx] = srcElement; },
973 *localExecutor,
974 approximateBlockSize
975 );
976 } else {
977 arraySubset.ForEach(
978 [&dst](TSize idx, TDst srcElement) { dst[idx] = srcElement; }
979 );
980 }
981
982 return dst;
983 }
984
985 template <class T, class TMaybePolicy, class TSize=size_t>
986 inline TMaybe<TVector<T>, TMaybePolicy> GetSubsetOfMaybeEmpty(

Callers 15

TrainEvalSplitFunction · 0.85
GetWorkerPartFunction · 0.85
GetRandomDatasetBatchFunction · 0.85
GetSubsetForFstrCalcFunction · 0.85
GetResultMethod · 0.85
GetLastResultMethod · 0.85
GetSubsetMethod · 0.85
CloneMethod · 0.85
CreateTrainTestSubsetsFunction · 0.85
Y_UNIT_TESTFunction · 0.85

Calls 6

NothingFunction · 0.85
yresizeMethod · 0.80
SizeMethod · 0.45
DefinedMethod · 0.45
ParallelForEachMethod · 0.45
ForEachMethod · 0.45

Tested by 1

TestGetSubsetFunction · 0.68