Skip to content

Conversation

@chriseclectic
Copy link
Collaborator

@chriseclectic chriseclectic commented May 13, 2021

Summary

This makes a couple of changes to the interleaved RB fitter.

Details and comments

  1. The main change is that it fits to the full 4-parameter model for the interleaved curve so that the the interleaved gate decay parameter is a direct model parameter.

This means the series fit functions are:

  • f_0(x, a, alpha, alpha_c, b) = a * alpha ** x + b
  • f_1(x, a, alpha, alpha_c, b) = a * (alpha * alpha_c) ** x + b
    and the std error in alpha_c and EPC can then be directly calculated from the fitter covariance matrix.
  1. Fixes what I think was a bug in the scale coefficient for EPC. It was scale = (nrb - 1) / (2 ** nrb) wher nrb = 2 ** num_qubits, but I think it was supposed to be (nrb - 1) / nrb, @gadial can you double check this?

  2. The second change is to the formatting of the returned figure. The figure now plots the raw unaveraged scatter data, and uses different colour curves for the standard and interleaved fits to distinguish them. It looks like this:

irbfit

@ShellyGarion
Copy link
Contributor

  1. Perhaps you would like to add a comment that these notations are different than the original interleaved RB paper, and provide a reference to the accelerated RB paper as well? (although this should be an equivalent calculation).
  2. Thanks for fixing the misprint in the scale. You are correct. I verified this in the paper, as well as ignis code.
    https://github.com/Qiskit/qiskit-ignis/blob/81955597ebabe1870088e4adc606f7ad2d71ffa8/qiskit/ignis/verification/randomized_benchmarking/fitters.py#L675


# Process data
def data_processor(datum):
return level2_probability(datum, datum["metadata"]["ylabel"])
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think having outcome label in circuit metadata is reasonable. I assumed processor option can be obtained from the metadata without extra data processing. Do you prefer having such extra data processing capability to generate data processor options?

https://github.com/Qiskit/qiskit-experiments/blob/1f64b4236864d28a7682da44e72f2bab2242013e/qiskit_experiments/analysis/curve_analysis.py#L367-L374

Copy link
Contributor

Choose a reason for hiding this comment

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

I prefer having it as part of the metadata as well, but have no strong feelings about it (note that if we change this we can remove this metadata from rb_experiment).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It seemed redundant to add the measurement label in metadata for every circuit when it's always the same and only depends on the number of qubits. Maybe it needs to be added if this is later a subclassed from a generic curve fit experiment.

Copy link
Collaborator

Choose a reason for hiding this comment

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

So we naively assume all 1 probability here (if outcome is not specified in the metadata)? I'm fine with this approach.

}

@classmethod
def _format_plot(cls, ax, analysis_result, add_label=True):
Copy link
Collaborator

@nkanazawa1989 nkanazawa1989 May 18, 2021

Choose a reason for hiding this comment

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

Do you think fit values is needed now? In old Ignis implementation this is kind of necessary because fit values are protected member. But now these values can be seen in the repr of analysis result object.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think it's nice to keep the info in the figure so you can get the main details without having to also look at the result.


# Process data
def data_processor(datum):
return level2_probability(datum, datum["metadata"]["ylabel"])
Copy link
Contributor

Choose a reason for hiding this comment

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

I prefer having it as part of the metadata as well, but have no strong feelings about it (note that if we change this we can remove this metadata from rb_experiment).

The error bounds are given by
:math:`E=\min\left\{ \begin{array}{c}
\frac{\left(d-1\right)\left[\left|p-p_{\overline{\mathcal{C}}}/p\right|+\left(1-p\right)\right]}{d}\\
\frac{\left(d-1\right)\left[\left|p-p_{\overline{\mathcal{C}}}\right|+\left(1-p\right)\right]}{d}\\
Copy link
Contributor

@ShellyGarion ShellyGarion May 18, 2021

Choose a reason for hiding this comment

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

Is the systematic error bounds calculation remain the same in this case?
Need to comment that the notation here is not the same as in the original interleaved RB paper,
namely that p_C here denotes p_C/p

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not 100% sure, I was hoping you or @gadial could double check this.

Copy link
Contributor

Choose a reason for hiding this comment

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

It looks OK to me, but maybe it's better to ask one of the co-authors of the original paper?
(and one should also comment that the notation is different than the original paper)

return analysis_result, figures

@staticmethod
def _generate_multi_scatter_plot(series, xdata, ydata, ax):
Copy link
Contributor

Choose a reason for hiding this comment

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

Note that the points of the standard and interleaved data are denoted the same (green x), only the fitting curve and mean and bars have separate colors

If analysis fails include the exception raised in the returned result so it can be viewed.
* Fit directly to alpha * alpha_c in interleaved model
* Use kwarg format for curve fitting
* plot raw data on scatter plot
* Change color of interleaved fit curve in figure and add legend.
@ShellyGarion
Copy link
Contributor

Note that now the graph of the 2-qubit interleaved Rb does not appear in the Jupyter notebook

Change way systematic error is reported in result to be "EPC_systematic_err" and "EPC_systematic_bounds"
@coruscating coruscating merged commit a733fe7 into qiskit-community:main May 26, 2021
@coruscating coruscating added this to the Release 0.1 milestone Jun 16, 2021
@chriseclectic chriseclectic deleted the irb-analysis branch July 21, 2021 18:45
paco-ri pushed a commit to paco-ri/qiskit-experiments that referenced this pull request Jul 11, 2022
* Fix bug in multi_curve_fit for kwarg params

* Add error message to failed analysis

If analysis fails include the exception raised in the returned result so it can be viewed.

* Update interleaved-rb analysis

* Fit directly to alpha * alpha_c in interleaved model
* Use kwarg format for curve fitting
* plot raw data on scatter plot
* Change color of interleaved fit curve in figure and add legend.

* update notebook

* unused variable

* Fix alpha_c initial guess

* Fix equation

* Update plot colors

* update notebook and systematic error

Change way systematic error is reported in result to be "EPC_systematic_err" and "EPC_systematic_bounds"
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

Successfully merging this pull request may close these issues.

5 participants