Skip to content

Commit 649ffdc

Browse files
author
quanjq1
committed
fix(histogram): correct scale factor calculation for cumulative frequency
1 parent d7f16f9 commit 649ffdc

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/sub_platforms/sql_opt/videx/videx_histogram.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ def model_post_init(self, __context: Any) -> None:
232232
if len(self.buckets) > 0:
233233
# check: sum(freq(buckets[-1] + null ratio) should be almost 1. if not, scale it.
234234
if abs(self.null_values + self.buckets[-1].cum_freq - 1) > 0.01:
235-
scale_factor = self.buckets[-1].cum_freq / (1 - self.null_values)
235+
scale_factor = (1 - self.null_values) / self.buckets[-1].cum_freq
236236
for bucket in self.buckets:
237237
bucket.cum_freq = bucket.cum_freq * scale_factor
238238
self.buckets[-1].cum_freq = 1

0 commit comments

Comments
 (0)