| 181 | |
| 182 | template <class TLayout> |
| 183 | class TDataSetBase { |
| 184 | public: |
| 185 | using TSamplesMapping = typename TLayout::TSamplesMapping; |
| 186 | using TCompressedIndex = TSharedCompressedIndex<TLayout>; |
| 187 | using TCompressedDataSet = typename TCompressedIndex::TCompressedDataSet; |
| 188 | |
| 189 | bool HasFeatures() const { |
| 190 | return PermutationIndependentFeatures != static_cast<ui32>(-1); |
| 191 | } |
| 192 | |
| 193 | bool HasPermutationDependentFeatures() const { |
| 194 | return PermutationDependentFeatures != static_cast<ui32>(-1); |
| 195 | } |
| 196 | |
| 197 | const TCompressedDataSet& GetFeatures() const { |
| 198 | CB_ENSURE(HasFeatures()); |
| 199 | return CompressedIndex->GetDataSet(PermutationIndependentFeatures); |
| 200 | } |
| 201 | |
| 202 | const TCompressedIndex& GetCompressedIndex() const { |
| 203 | CB_ENSURE(CompressedIndex); |
| 204 | return *CompressedIndex; |
| 205 | } |
| 206 | |
| 207 | const TCompressedDataSet& GetPermutationFeatures() const { |
| 208 | CB_ENSURE(HasPermutationDependentFeatures()); |
| 209 | return CompressedIndex->GetDataSet(PermutationDependentFeatures); |
| 210 | } |
| 211 | |
| 212 | bool HasFeature(ui32 featureId) const { |
| 213 | if (HasFeatures() && GetFeatures().HasFeature(featureId)) { |
| 214 | return true; |
| 215 | } else if (HasPermutationDependentFeatures()) { |
| 216 | return GetPermutationFeatures().HasFeature(featureId); |
| 217 | } else { |
| 218 | return false; |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | const NCudaLib::TDistributedObject<TCFeature>& GetTCFeature(ui32 featureId) const { |
| 223 | CB_ENSURE(HasFeature(featureId)); |
| 224 | if (HasFeatures() && GetFeatures().HasFeature(featureId)) { |
| 225 | return GetFeatures().GetTCFeature(featureId); |
| 226 | } else if (HasPermutationDependentFeatures()) { |
| 227 | return GetPermutationFeatures().GetTCFeature(featureId); |
| 228 | } else { |
| 229 | CB_ENSURE(false); |
| 230 | } |
| 231 | Y_UNREACHABLE(); |
| 232 | } |
| 233 | |
| 234 | bool IsOneHot(ui32 featureId) const { |
| 235 | CB_ENSURE(HasFeature(featureId)); |
| 236 | if (HasFeatures() && GetFeatures().HasFeature(featureId)) { |
| 237 | return GetFeatures().IsOneHot(featureId); |
| 238 | } else if (HasPermutationDependentFeatures()) { |
| 239 | return GetPermutationFeatures().IsOneHot(featureId); |
| 240 | } else { |
nothing calls this directly
no test coverage detected