Skip to content

Add process_expectation_values_pea#2948

Open
dekelmeirom wants to merge 21 commits into
Qiskit:mainfrom
dekelmeirom:pea_postprocess
Open

Add process_expectation_values_pea#2948
dekelmeirom wants to merge 21 commits into
Qiskit:mainfrom
dekelmeirom:pea_postprocess

Conversation

@dekelmeirom

@dekelmeirom dekelmeirom commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

Summary

Add a post-process function to calculate the extrapolated expectation values when using PEA EM method.

Details and comments

Fixes #2947

AI/LLM disclosure

  • I used the following tool to generate or modify code: bob

@dekelmeirom dekelmeirom self-assigned this Jun 23, 2026
@dekelmeirom dekelmeirom added the wrapper-estimator Related to WrapperEstimator label Jun 23, 2026
@dekelmeirom

Copy link
Copy Markdown
Collaborator Author

I copied the extrapolation methods from #2889 and changed its I/O. Can be merged only after #2889 is merged!

@dekelmeirom dekelmeirom marked this pull request as ready for review July 1, 2026 17:42
@dekelmeirom

Copy link
Copy Markdown
Collaborator Author

The extrapolation I/O changes were moved to a separate PR which will need to be merged first - #3000 (the tests will fail until this PR will be merged, but they pass combined with this PR code)

Comment thread qiskit_ibm_runtime/decoders/executor_estimator/post_processor_v0_1.py Outdated
dekelmeirom added a commit to dekelmeirom/qiskit-ibm-runtime that referenced this pull request Jul 14, 2026
…hods (Qiskit#3000)

### Summary

Change the extrapolation input and output to align with the flow of the
EM methods.

### Details and comments

Related to Qiskit#2948 and Qiskit#2953 

### AI/LLM disclosure

- [ ] I didn't use LLM tooling, or only used it privately.
- [ ] I used the following tool to help write this PR description:
- [X] I used the following tool to generate or modify code: bob

---------

Co-authored-by: TsafrirA <113579969+TsafrirA@users.noreply.github.com>

@TsafrirA TsafrirA left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The code changes look good!
I left some nitpicks about doc strings and validations. The tests covering the post processing are essentially duplicated. We need to leave just one set of tests in.

(I stumbled upon #3037 while reviewing, but it's beyond the scope of this PR)

Comment thread qiskit_ibm_runtime/decoders/executor_estimator/post_processor_v0_1.py Outdated
pec_gammas = post_processor_data.get("pec_gammas", None)

# Extract pea mitigation data if present
pea_noise_factors = post_processor_data.get("pea_noise_factors", None)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

At no point do you verify that pea_noise_factors and extrapolated_noise_factors are not None (when PEA is enabled). It's not clear to me how it passes static type checks.

Comment thread qiskit_ibm_runtime/decoders/executor_estimator/post_processor_v0_1.py Outdated


@ddt
class TestProcessExpectationValuesPEA(unittest.TestCase):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This class and TestCreatePubResultPea overlap completely.
What we did with PEC, was leaving just one set of tests.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I removed the TestCreatePubResultPea tests

# Shape: (num_randomizations, num_noise_scales, num_configs, shots, num_bits)
# where num_configs is the total number of (param_index, basis) pairs
raise ValueError(f"``item_result['_meas']`` has ``{data.ndim}`` axes, expected ``5``.")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do we want to verify that the number of noise scales in the data is the same as in passthrough data?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I added such check :)

@SamFerracin SamFerracin changed the title add process_expectation_values_pea Add process_expectation_values_pea Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wrapper-estimator Related to WrapperEstimator

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wire PEA postprocess with extrapolation method

3 participants