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

Function GetDataMetaInfo

catboost/private/libs/quantized_pool/quantized.cpp:78–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76}
77
78NCB::TDataMetaInfo GetDataMetaInfo(
79 const NCB::TQuantizedPool& pool,
80 bool hasAdditionalGroupWeight,
81 bool hasTimestamps,
82 bool hasPairs,
83 bool forceUnitAutoPairWeights,
84 TMaybe<ui32> baselineCount,
85 const NCB::TPathWithScheme& featureNamesPath,
86 const NCB::TPathWithScheme& poolMetaInfoPath
87) {
88 const size_t columnsCount = pool.ColumnIndexToLocalIndex.size();
89 NCB::TDataColumnsMetaInfo dataColumnsMetaInfo;
90 dataColumnsMetaInfo.Columns.resize(columnsCount);
91
92 bool hasTargets = false;
93
94 for (const auto [columnIndex, localIndex] : pool.ColumnIndexToLocalIndex) {
95 const auto columnType = pool.ColumnTypes[localIndex];
96 if (columnType == EColumn::Label) {
97 hasTargets = true;
98 }
99 dataColumnsMetaInfo.Columns[columnIndex].Type = pool.ColumnTypes[localIndex];
100 dataColumnsMetaInfo.Columns[columnIndex].Id = pool.ColumnNames[localIndex];
101 }
102
103 NCB::ERawTargetType targetType;
104 if (hasTargets) {
105 if (pool.QuantizationSchema.IntegerClassLabelsSize()) {
106 targetType = NCB::ERawTargetType::Integer;
107 } else if (pool.QuantizationSchema.FloatClassLabelsSize()) {
108 targetType = NCB::ERawTargetType::Float;
109 } else if (pool.QuantizationSchema.ClassNamesSize()) {
110 targetType = NCB::ERawTargetType::String;
111 } else {
112 targetType = NCB::ERawTargetType::Float;
113 }
114 } else {
115 targetType = NCB::ERawTargetType::None;
116 }
117
118 const TVector<TString> featureNames = NCB::GetFeatureNames(
119 dataColumnsMetaInfo,
120 /*headerColumns*/ Nothing(),
121 featureNamesPath
122 );
123
124 const auto poolMetaInfoOptions = NCatboostOptions::LoadPoolMetaInfoOptions(poolMetaInfoPath);
125
126 NCB::TDataMetaInfo metaInfo(
127 std::move(dataColumnsMetaInfo),
128 targetType,
129 hasAdditionalGroupWeight,
130 hasTimestamps,
131 hasPairs,
132 /*hasGraph*/ false,
133 /*loadSampleIds*/ false,
134 forceUnitAutoPairWeights,
135 baselineCount,

Callers 1

Calls 8

NothingFunction · 0.85
LoadPoolMetaInfoOptionsFunction · 0.85
GetFeatureNamesFunction · 0.50
moveFunction · 0.50
sizeMethod · 0.45
resizeMethod · 0.45
GetMethod · 0.45
ValidateMethod · 0.45

Tested by

no test coverage detected