[Costs] Success probability#970
Conversation
| logger = logging.getLogger(__name__) | ||
|
|
||
|
|
||
| @frozen |
There was a problem hiding this comment.
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.
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.
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.
fdmalone
left a comment
There was a problem hiding this comment.
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.
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.
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
CostKeyfor multiplying success probabilities. Part of #899