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

Add cirq.TensoredConfusionMatrices for readout error mitigation. #4854

Merged
merged 15 commits into from
Jan 21, 2022

Conversation

tanujkhattar
Copy link
Collaborator

@tanujkhattar tanujkhattar requested review from cduck, mrwojtek, vtomole and a team as code owners January 19, 2022 00:34
@CirqBot CirqBot added the size: L 250< lines changed <1000 label Jan 19, 2022
@tanujkhattar tanujkhattar requested a review from viathor January 19, 2022 00:34
Copy link
Collaborator

@mpharrigan mpharrigan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

super cool. I think an abstraction to tensor-product a big cm from small ones is very useful to have.

I strongly worry about using the words and variable names "confusion matrix" to refer both to (ndarray, Sequence[Qid]) tuples and to ReadoutConfusionMatrix as a source of ... confusion

cirq-core/cirq/experiments/readout_confusion_matrix.py Outdated Show resolved Hide resolved
cirq-core/cirq/experiments/readout_confusion_matrix.py Outdated Show resolved Hide resolved
cirq-core/cirq/experiments/readout_confusion_matrix.py Outdated Show resolved Hide resolved
cirq-core/cirq/experiments/readout_confusion_matrix.py Outdated Show resolved Hide resolved
cirq-core/cirq/experiments/readout_confusion_matrix.py Outdated Show resolved Hide resolved
cirq-core/cirq/experiments/readout_confusion_matrix.py Outdated Show resolved Hide resolved
cirq-core/cirq/experiments/readout_confusion_matrix.py Outdated Show resolved Hide resolved
@mpharrigan
Copy link
Collaborator

This also uses raw numpy arrays for the "results" bitstrings and an explicit back-mapping to qubit identities; which I think is correct to make this functionality composable. But it puts a big onus on the experimenter like described in #4449

Copy link
Collaborator

@MichaelBroughton MichaelBroughton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks awesome! Few high level questions:

  1. Should the measure_confusion_matrix function have a parallel vs isolated operation mode ? Thinking along the lines of how measure the data for the 2x2 confusion matrices slightly differently for things like p00_isolated vs p00_parallel. WDYT ?
  2. Can we generalize this a little more to make the readout characterization that we also have in the experiments dir obsolete ?

@tanujkhattar
Copy link
Collaborator Author

tanujkhattar commented Jan 19, 2022

  1. Should the measure_confusion_matrix function have a parallel vs isolated operation mode ? Thinking along the lines of how measure the data for the 2x2 confusion matrices slightly differently for things like p00_isolated vs p00_parallel. WDYT ?

Yes, this is a good idea but I think we can do this in a follow-up PR.

  1. Can we generalize this a little more to make the readout characterization that we also have in the experiments dir obsolete ?

I guess once 1. above is done, we should be able to make the single qubit readout calibration obsolete since it just represents single qubit confusion matrices for each qubit. We will have to go through a deprecation cycle though and I think it's a widely used method so there will be quite a few places to update.

I'd recommend to open separate issues for both 1 & 2 above and do them in separate PRs. LMK your thoughts.

I've addressed all other comments. cc @mpharrigan

@tanujkhattar tanujkhattar changed the title Add cirq.ReadoutConfusionMatrix for readout error mitigation. Add cirq.TensoredConfusionMatrices for readout error mitigation. Jan 19, 2022
Copy link
Collaborator

@mrwojtek mrwojtek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is quite neat implementation!

@tanujkhattar tanujkhattar requested a review from mrwojtek January 20, 2022 23:09
@tanujkhattar
Copy link
Collaborator Author

@mrwojtek Addressed all comments. PTAL.

Copy link
Collaborator

@mrwojtek mrwojtek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented on the optimization failure above.

@tanujkhattar
Copy link
Collaborator Author

@mrwojtek Fixed.

Copy link
Collaborator

@mrwojtek mrwojtek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@mrwojtek mrwojtek self-requested a review January 21, 2022 13:30
@tanujkhattar tanujkhattar dismissed mrwojtek’s stale review January 21, 2022 13:47

Stale review, changes have been addressed.

@MichaelBroughton MichaelBroughton added the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Jan 21, 2022
@CirqBot CirqBot added the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Jan 21, 2022
@CirqBot
Copy link
Collaborator

CirqBot commented Jan 21, 2022

Automerge cancelled: A required status check is not present.

Missing statuses: ['Pytest MacOS (3.7)', 'Pytest MacOS (3.8)', 'Pytest MacOS (3.9)', 'Pytest Windows (3.7)', 'Pytest Windows (3.8)', 'Pytest Windows (3.9)', 'Typescript lint check', 'Typescript tests', 'Typescript tests coverage']

@CirqBot CirqBot removed automerge Tells CirqBot to sync and merge this PR. (If it's running.) front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. labels Jan 21, 2022
@MichaelBroughton MichaelBroughton added the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Jan 21, 2022
@CirqBot CirqBot added the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Jan 21, 2022
@CirqBot CirqBot merged commit b2fa642 into quantumlib:master Jan 21, 2022
@CirqBot CirqBot removed automerge Tells CirqBot to sync and merge this PR. (If it's running.) front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. labels Jan 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: L 250< lines changed <1000
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Utilities for measurement error mitigation using confusion matrix (aka calibration matrix)
6 participants