| 71 | } |
| 72 | |
| 73 | TVector<ui32> NCatboostCuda::GetLearnFeatureIds(NCatboostCuda::TBinarizedFeaturesManager& featuresManager) { |
| 74 | TSet<ui32> featureIdsSet; |
| 75 | auto ctrTypes = featuresManager.GetKnownSimpleCtrTypes(); |
| 76 | |
| 77 | for (auto floatFeature : featuresManager.GetFloatFeatureIds()) { |
| 78 | if (featuresManager.GetBinCount(floatFeature) > 1) { |
| 79 | featureIdsSet.insert(floatFeature); |
| 80 | } |
| 81 | } |
| 82 | for (auto catFeature : featuresManager.GetCatFeatureIds()) { |
| 83 | if (featuresManager.UseForOneHotEncoding(catFeature)) { |
| 84 | if (featuresManager.GetBinCount(catFeature) > 1) { |
| 85 | featureIdsSet.insert(catFeature); |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | if (featuresManager.UseForCtr(catFeature)) { |
| 90 | for (auto& ctr : ctrTypes) { |
| 91 | const auto simpleCtrsForType = featuresManager.CreateSimpleCtrsForType(catFeature, |
| 92 | ctr); |
| 93 | for (auto ctrFeatureId : simpleCtrsForType) { |
| 94 | featureIdsSet.insert(ctrFeatureId); |
| 95 | } |
| 96 | } |
| 97 | } |
| 98 | } |
| 99 | TSet<ui32> combinationCtrIds; |
| 100 | |
| 101 | for (auto& ctr : ctrTypes) { |
| 102 | auto combinationCtrs = featuresManager.CreateCombinationCtrForType(ctr); |
| 103 | for (auto ctrFeatureId : combinationCtrs) { |
| 104 | TFeatureTensor tensor = featuresManager.GetCtr(ctrFeatureId).FeatureTensor; |
| 105 | bool hasUnknownFeatures = false; |
| 106 | CB_ENSURE(tensor.GetSplits().size() == 0); |
| 107 | |
| 108 | for (auto featureId : tensor.GetCatFeatures()) { |
| 109 | if (!featureIdsSet.contains(featureId)) { |
| 110 | hasUnknownFeatures = true; |
| 111 | break; |
| 112 | } |
| 113 | } |
| 114 | for (auto binarySplit : tensor.GetSplits()) { |
| 115 | if (!featureIdsSet.contains(binarySplit.FeatureId)) { |
| 116 | hasUnknownFeatures = true; |
| 117 | break; |
| 118 | } |
| 119 | } |
| 120 | if (!hasUnknownFeatures) { |
| 121 | combinationCtrIds.insert(ctrFeatureId); |
| 122 | } |
| 123 | } |
| 124 | } |
| 125 | featureIdsSet.insert(combinationCtrIds.begin(), combinationCtrIds.end()); |
| 126 | |
| 127 | auto estimatedFeatures = featuresManager.GetEstimatedFeatureIds(); |
| 128 | featureIdsSet.insert(estimatedFeatures.begin(), estimatedFeatures.end()); |
| 129 | |
| 130 | auto featureBundleIds = featuresManager.GetExclusiveFeatureBundleIds(); |
nothing calls this directly
no test coverage detected