-
Notifications
You must be signed in to change notification settings - Fork 50
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
[Costs] Success probability #970
[Costs] Success probability #970
Conversation
logger = logging.getLogger(__name__) | ||
|
||
|
||
@frozen |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of scope for this PR but it would be nice to have some notebook expanding on this as a concept (success probability)
logger.info("Computing %s for %s from %d callee(s)", self, bloq, len(callees)) | ||
for callee, n in callees: | ||
v = get_callee_cost(callee) | ||
tot *= v**n |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would we eventually need to deal with like the log of the success probability so things are additive. This looks like it runs the risk of potentially hitting numerical issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realized later that after writing this that if the success probability was so small to warrant something special it would be a dreadful quantum algorithm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I think multiplying lots of numbers together is potentially risky, but maybe it's not really a concern.
_why_is_everything_so_private_lately?
def compute(self, bloq: 'Bloq', get_callee_cost: Callable[['Bloq'], float]) -> float: | ||
tot: float = 1.0 | ||
callees = get_bloq_callee_counts(bloq) | ||
logger.info("Computing %s for %s from %d callee(s)", self, bloq, len(callees)) | ||
for callee, n in callees: | ||
v = get_callee_cost(callee) | ||
tot *= v**n |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way this is written, would we ever need this as a separate cost? Can we just use g, sigma = bloq.build_call_graph(pred=pred)
and then accumulate the error probability using bloq, counts in sigma
?
Is there a good example that motivates this cost key that already exists in another branch / is easy to describe ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you need the contributions from inner nodes as well, not just the leafs that will show up in sigma
.
This was requested by someone at the IEEE meeting last year and is a good demo of a different type of cost
Add a new
CostKey
for multiplying success probabilities. Part of #899