Skip to content

Commit

Permalink
Remove unused sort (#206)
Browse files Browse the repository at this point in the history
  • Loading branch information
mccalluc authored Jan 7, 2025
1 parent a63a215 commit 4c217fb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion dp_wizard/utils/code_generators/no-tests/_query.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
QUERY_NAME = context.query().group_by(BIN_NAME).agg(pl.len().dp.noise())
ACCURACY_NAME = QUERY_NAME.summarize(alpha=1 - confidence)["accuracy"].item()
HISTOGRAM_NAME = QUERY_NAME.release().collect().sort(BIN_NAME)
HISTOGRAM_NAME = QUERY_NAME.release().collect()
OUTPUT_BLOCK
6 changes: 2 additions & 4 deletions dp_wizard/utils/dp_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def make_accuracy_histogram(
... )
>>> accuracy
3.37...
>>> histogram
>>> histogram.sort("bin")
shape: (5, 2)
┌─────────┬─────┐
│ bin ┆ len │
Expand Down Expand Up @@ -81,7 +81,5 @@ def make_accuracy_histogram(
query = context.query().group_by("bin").agg(pl.len().dp.noise()) # type: ignore

accuracy = query.summarize(alpha=1 - confidence)["accuracy"].item() # type: ignore
# The sort is alphabetical. df_to_columns needs to be used
# downstream to parse interval and sort by numeric value.
histogram = query.release().collect().sort("bin")
histogram = query.release().collect()
return (accuracy, histogram)

0 comments on commit 4c217fb

Please sign in to comment.