Skip to content

Commit 785dc6a

Browse files
committed
Fixed a bug in the physical predictor where it tries to calculate accuracy even if the operator produce zero columns
1 parent f211841 commit 785dc6a

File tree

2 files changed

+4
-19
lines changed

2 files changed

+4
-19
lines changed

src/execution/operator/projection/physical_predict.cpp

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -148,25 +148,6 @@ OperatorResultType PhysicalPredict::Execute(ExecutionContext &context, DataChunk
148148
}
149149
#endif
150150

151-
int positives = 0;
152-
auto lhs = (float *)input.data[1].GetData();
153-
154-
auto neg = (float *)predictions.data[0].GetData();
155-
auto pos = (float *)predictions.data[1].GetData();
156-
157-
for (size_t i = 0; i < input.size(); i++) {
158-
if ((*pos > *neg && *lhs > 0) || (*pos < *neg && *lhs < 1)) {
159-
positives++;
160-
}
161-
lhs++;
162-
// rhs++;
163-
neg++;
164-
pos++;
165-
}
166-
167-
state.stats->correct += positives;
168-
state.stats->total += input.size();
169-
170151
chunk.Fuse(predictions);
171152
return OperatorResultType::NEED_MORE_INPUT;
172153
}

third_party/predictors/llm_api/duckdb_llm_api.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,10 @@ void LlmApiPredictor::PredictChunk(DataChunk &input, DataChunk &output, int rows
140140
end = std::chrono::steady_clock::now();
141141
stats->move_rev += std::chrono::duration_cast<std::chrono::microseconds>(end - begin).count();
142142
#endif
143+
144+
// TODO: Calculate the accuracy metric here for the prediction and update the stats.correct and stats.total
145+
// stats->correct += <no_of_positives>;
146+
// stats->total += rows;
143147
}
144148
}
145149

0 commit comments

Comments
 (0)