| 394 | } |
| 395 | |
| 396 | void NCB::TCBQuantizedDataLoader::Do(IQuantizedFeaturesDataVisitor* visitor) { |
| 397 | visitor->Start( |
| 398 | DataMetaInfo, |
| 399 | ObjectCount, |
| 400 | ObjectsOrder, |
| 401 | {}, |
| 402 | QuantizationSchemaFromProto(QuantizedPool.QuantizationSchema), |
| 403 | /*wholeColumns*/ false); |
| 404 | |
| 405 | const auto columnIdxToTargetIdx = GetColumnIndexToTargetIndexMap(QuantizedPool); |
| 406 | const auto columnIdxToFlatIdx = GetColumnIndexToFlatIndexMap(QuantizedPool); |
| 407 | const auto columnIdxToBaselineIdx = GetColumnIndexToBaselineIndexMap(QuantizedPool); |
| 408 | const auto chunkRefs = GatherAndSortChunks(QuantizedPool); |
| 409 | |
| 410 | TSequentialChunkEvictor evictor(1ULL << 24); |
| 411 | CATBOOST_DEBUG_LOG << "Number of chunks to process " << chunkRefs.size() << Endl; |
| 412 | for (const auto chunkRef : chunkRefs) { |
| 413 | if (QuantizedPool.ChunkStorage.empty()) { // reading from mapped file |
| 414 | evictor.Push(chunkRef); |
| 415 | } |
| 416 | Y_DEFER { evictor.MaybeEvict(); }; |
| 417 | |
| 418 | const auto columnIdx = chunkRef.ColumnIndex; |
| 419 | const auto localIdx = chunkRef.LocalIndex; |
| 420 | const auto isStringColumn = QuantizedPool.HasStringColumns && |
| 421 | (localIdx == QuantizedPool.StringDocIdLocalIndex || |
| 422 | localIdx == QuantizedPool.StringGroupIdLocalIndex || |
| 423 | localIdx == QuantizedPool.StringSubgroupIdLocalIndex); |
| 424 | if (isStringColumn) { |
| 425 | // Ignore string columns, they are only needed for fancy output for evaluation. |
| 426 | continue; |
| 427 | } |
| 428 | |
| 429 | const auto columnType = QuantizedPool.ColumnTypes[localIdx]; |
| 430 | if (columnType == EColumn::SampleId) { |
| 431 | // Skip DocId columns presented in old pools. |
| 432 | continue; |
| 433 | } |
| 434 | |
| 435 | CB_ENSURE( |
| 436 | EqualToOneOf(columnType, EColumn::Num, EColumn::Baseline, |
| 437 | EColumn::Label, EColumn::Categ, EColumn::Weight, |
| 438 | EColumn::GroupWeight, EColumn::GroupId, EColumn::SubgroupId, |
| 439 | EColumn::Timestamp), |
| 440 | "Expected Num, Baseline, Label, Categ, Weight, GroupWeight, GroupId, Subgroupid, or Timestamp; got " |
| 441 | LabeledOutput(columnType, columnIdx)); |
| 442 | if (!DatasetSubset.HasFeatures) { |
| 443 | CB_ENSURE( |
| 444 | columnType != EColumn::Num && columnType != EColumn::Categ, |
| 445 | "CollectChunks collected a feature chunk despite HasFeatures = false"); |
| 446 | } |
| 447 | |
| 448 | const auto* const flatFeatureIdx = columnIdxToFlatIdx.FindPtr(columnIdx); |
| 449 | if (flatFeatureIdx && IsFeatureIgnored[*flatFeatureIdx]) { |
| 450 | continue; |
| 451 | } |
| 452 | |
| 453 | const auto* const baselineIdx = columnIdxToBaselineIdx.FindPtr(columnIdx); |
nothing calls this directly
no test coverage detected