# How does measurement calibration work?

One of the possible ways to improve the results of an experiment on the IBM machine using the Qiskit language is to use the measurement calibration methods. This is the link to the documentation.

I understood that the calibration matrix is made looking at when a qubit in a determined state is measured in one other state. But I didn't get how this calibration matrix is applied to the results to obtain the mitigated results.

This is the command used: mitigated_results = meas_filter.apply(my_results, method).

• Are you looking for a more technical answer, like what the code specifically does? Or a more conceptual answer, like what the broad procedure is to normally mitigate these errors? – Matthew Stypulkoski May 31 '19 at 19:37
• The conceptual answer should be good enough, after that I can study the code myself. But it should be fine if it could be a little more specific of the description in the documentation. – Marco Ballarin Jun 1 '19 at 20:33
• Thanks for the question. I'll see if I can get you an answer. – James Wootton Jun 4 '19 at 17:19

There are two methods, when you look at the code you'll see their names: pseudo_inverse and least_squares (https://github.com/Qiskit/qiskit-ignis/blob/master/qiskit/ignis/mitigation/measurement/filters.py). pseudo_inverse is the simpler one, it applies the inverse of the calibration matrix on the measurement results. However it has some issues, which require the usage of the least_squares method, which finds valid mitigated results, such that: $$\text{min}_{P_{\rho}} ||\tilde{P}_{\rho}-\mathbf{A}\cdot P_{\rho}||$$ where $$\mathbf{A}$$ is the calibration matrix and $$\tilde{P}_{\rho}$$ are the measurement results. Please see more details in the last section of https://github.com/Qiskit/qiskit-tutorials/blob/master/community/ignis/measurement_error_mitigation.ipynb. In particular about the issues related to the pseudo inverse.