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

Method GetSubsetImpl

catboost/libs/data/objects.cpp:777–830  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

775
776
777TObjectsDataProviderPtr NCB::TRawObjectsDataProvider::GetSubsetImpl(
778 const TObjectsGroupingSubset& objectsGroupingSubset,
779 TMaybe<TConstArrayRef<ui32>> ignoredFeatures,
780 ui64 cpuRamLimit,
781 NPar::ILocalExecutor* localExecutor
782) const {
783 TCommonObjectsData subsetCommonData = CommonData.GetSubset(
784 objectsGroupingSubset,
785 localExecutor
786 );
787
788 // needed only for sparse features
789 TMaybe<TFeaturesArraySubsetInvertedIndexing> subsetInvertedIndexing;
790
791 if (CommonData.FeaturesLayout->HasSparseFeatures()) {
792 subsetInvertedIndexing.ConstructInPlace(
793 GetInvertedIndexing(objectsGroupingSubset.GetObjectsIndexing(), GetObjectCount(), localExecutor)
794 );
795 }
796
797 if (ignoredFeatures.Defined()) {
798 subsetCommonData.FeaturesLayout = MakeIntrusive<TFeaturesLayout>(*subsetCommonData.FeaturesLayout);
799 subsetCommonData.FeaturesLayout->IgnoreExternalFeatures(*ignoredFeatures);
800 }
801
802 auto resourceConstrainedExecutor = CreateCpuRamConstrainedExecutor(cpuRamLimit, localExecutor);
803
804 TRawObjectsData subsetData;
805
806 auto getSubsetWithScheduling = [&] (const auto& srcFeatures, auto* dstFeatures) {
807 GetSubsetWithScheduling(
808 MakeConstArrayRef(srcFeatures),
809 subsetCommonData.SubsetIndexing.Get(),
810 subsetInvertedIndexing,
811 &resourceConstrainedExecutor,
812 dstFeatures
813 );
814 };
815
816 getSubsetWithScheduling(Data.FloatFeatures, &subsetData.FloatFeatures);
817 getSubsetWithScheduling(Data.CatFeatures, &subsetData.CatFeatures);
818 getSubsetWithScheduling(Data.TextFeatures, &subsetData.TextFeatures);
819 getSubsetWithScheduling(Data.EmbeddingFeatures, &subsetData.EmbeddingFeatures);
820
821 resourceConstrainedExecutor.ExecTasks();
822
823 return MakeIntrusive<TRawObjectsDataProvider>(
824 objectsGroupingSubset.GetSubsetGrouping(),
825 std::move(subsetCommonData),
826 std::move(subsetData),
827 true,
828 Nothing()
829 );
830}
831
832template <class T>
833static bool HasDenseData(const TVector<THolder<T>>& columns) {

Callers

nothing calls this directly

Calls 15

GetInvertedIndexingFunction · 0.85
GetObjectCountFunction · 0.85
GetSubsetWithSchedulingFunction · 0.85
MakeConstArrayRefFunction · 0.85
NothingFunction · 0.85
ExecTasksMethod · 0.80
GetSubsetGroupingMethod · 0.80
moveFunction · 0.50
GetSubsetMethod · 0.45

Tested by

no test coverage detected