<jupyter_start><jupyter_text>Correcting GHZ probabilities on MelbourneShows how to correct for really bad readout errors and transforming to true probability distribution.<jupyter_code>import numpy as np
from qiskit import *
import mthree
mthree.about()
IBMQ.load_account()
provider = IBMQ.get_provider(group='deployed')
backend = provider.backend.ibmq_16_melbourne
qc = QuantumCircuit(5)
qc.h(2)
qc.cx(2,1)
qc.cx(1,0)
qc.cx(2,3)
qc.cx(3,4)
qc.measure_all()
trans_qc = transpile(qc, backend)
raw_counts = backend.run(trans_qc, shots=2048).result().get_counts()
mit = mthree.M3Mitigation(backend)
mit.tensored_cals_from_system(range(qc.num_qubits))
quasi, details = mit.apply_correction(raw_counts, range(qc.num_qubits), details=True)
details
from qiskit.visualization import plot_histogram
plot_histogram([raw_counts, quasi.nearest_probability_distribution()], figsize=(10,5),
              legend=['raw', 'm3-mitigated'])<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11974789915966387, 'fraction_numerical': 0.022058823529411766, 'mean_word_length': 7.663636363636364, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '95862', 'license': 'Apache-2.0', 'n_tokens_mistral': 368, 'n_tokens_neox': 338, 'n_words': 65, 'path': 'examples/correcting_for_probabilities.ipynb', 'repo_name': 'mtreinish/mthree', 'size': '952'}