Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C++ Proposal: Return doubles #60

Open
dasmdasm opened this issue Oct 23, 2020 · 0 comments
Open

C++ Proposal: Return doubles #60

dasmdasm opened this issue Oct 23, 2020 · 0 comments

Comments

@dasmdasm
Copy link

This is a proposed change to the C++ building blocks library. I'm posting it here to solicit feedback and suggestions before we make a final call on implementing it.

Currently all our Algorithms return their results in the form out Output protocol buffers. Most users use our custom utility functions to retrieve the result. Output protocol buffers can contain any one of a number of different data types, which are represented as different fields.

We've seen this lead to a lot of confusion. Some Algorithms don't return the same type as their input (e.g. Count), and if you try to fetch the wrong type of result you'll get a default value rather than an error. "Why does the algorithm always return 0?" is a frequent question for users of Count.

We'd like to stop returning multiple types and return only doubles instead. We'll still use the proto structure (the ability to return more than one double is useful in, e.g. ApproxBounds), but will replace the inner Value proto (which can hold multiple types) with a double. We're doing all the math as doubles anyway, so there's no precision loss. If you want your differentially private count to be an integer rather than a double, you can cast it yourself rather than having us do it under the hood. We'll also modify the GetValue<T> methods to be simple casts, so if you're currently doing GetValue<T>(algorithm.PartialResult()) your code will keep working without any changes. If you are handling the Output protos yourself, though, this will be a breaking change for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant