Path: blob/main/notebooks/summer-school/2021/resources/lab-notebooks/lab-5.ipynb
3855 views
In this lab, you will see how noise affects a typical parameterized quantum circuit used in machine learning using quantum process tomography.
Question 1
Make this Quantum Circuit
Quantum Process Tomography with Only Shot Noise
Here we will now use the qasm_simulator to simulate a Quantum Process Tomography Circuit
Question 2a
Using the Process Tomography Circuits function built into qiskit, create the set of circuits to do quantum process tomography and simulation with a qasm simulator (with shot noise only). For this please use the execute function of the QPT Circuits with
seed_simulator=3145,seed_transpiler=3145andshots=8192.Hint: The appropriate function, process_tomography_circuits, has been imported above. When complete you should have a total of 144 circuits that are given to the
qasm_simulatorvia theexecutefunction. You can find out the number of circuits created usinglen(qpt_circs).
Question 2b
Using a least squares fitting method for the Process Tomography Fitter, determine the fidelity of your target unitary
Hint: First use the ProcessTomographyFitter function above to process the results from question 2a and use ProcessTomographyFitter.fit(method='....') to extract the "Choi Matrix", which effectively describes the measured unitary operation. From here you will use the average_gate_fidelity function from the quantum information module to extract the achieved fidelity of your results
Quantum Process Tomography with a T1/T2 Noise Model
For the sake of consistency, let's set some values to characterize the duration of our gates and T1/T2 times:
Question 3
Using the Thermal Relaxation Error model built into qiskit, define
u1,u2,u3,cx,measureandreseterrors using the values for qubits 0-3 defined above, and build a thermal noise model.Hint: The Qiskit tutorial on building noise models will prove to be useful, particularly where they add quantum errors for
u1,u2,u3,cx,reset, andmeasureerrors (please include all of these).
Question 4.
Get a QPT fidelity using the noise model,but without using any error mitigation techniques. Again, use
seed_simulator=3145,seed_transpiler=3145andshots=8192for theexecutefunctionHint: The process here should be very similar to that in question 2a/b, except you will need to ensure you include the noise model from question 3 in the
executefunction
Question 5.
Use the
complete_meas_calfunction built into qiskit and apply to the QPT results in the previous question. For both, use theexecutefunction andseed_simulator=3145,seed_transpiler=3145andshots=8192. Also include the noise model from question 3 in theexecutefunction.Hint: The Qiskit textbook has a very good chapter on readout error mitigation. Specifically, you will want to use the
complete_meas_calfunction to generate the desired set of circuits to create the calibration matrix withCompleteMeasureFitterfunction. This can then be used to generate a correction matrixmeas_filter. Apply this function to the results from question 4.
Exploratory Question 6.
Test how the gate fidelity depends on the CX duration by running noise models with varying cx durations (but leaving everything else fixed).
(Note: this would ideally be done using the scaling technique discussed in the previous lecture, but due to backend availability limitations we are instead demonstrating the effect by adjusting duration of the CX itself. This is not exactly how this is implemented on the hardware itself as the gates are not full CX gates.)