I want to easily create a Noise Model

I want to easily create a Noise Model!

In Qiskit, it is possible to get closer to a real device by adding Noise when simulating a circuit with a simulator. However, setting Noise is highly specialized and extremely difficult. (In my opinion ...)

So, when I searched for an easy way to create a NoiseModel, I found it, so I will summarize it here.

Ideal circuit

First, create a circuit that creates a GHZ state without Noise for comparison.

GHZ state

GHZ state at 3qubits

|GHZ> = \frac{|000>+|111>}{\sqrt{2}}

import

python


# matplotlib inline
from qiskit import execute, QuantumCircuit, QuantumRegister
from qiskit.visualization import plot_histogram
from qiskit import BasicAer

Let's display the circuit


#Definition of quantum register
qr = QuantumRegister(3)
#Definition of quantum circuit
qc = QuantumCircuit(qr)

#Hadamard gate to 0bit
qc.h(0)
# 0bit-CNOT with 1bit
qc.cx(0, 1)
# 1bit-CNOT with 2bit
qc.cx(1, 2)

#Measure all quantum registers
qc.measure_all()

#Show circuit
qc.draw(output='mpl')

GHZ.png

I will do it

#backend settings
backend = BasicAer.get_backend('qasm_simulator')
#Circuit execution
result = execute(qc, backend).result()
#Get counts
counts = result.get_counts()
#plot counts into a histogram
plot_histogram(counts)

GHZ_plot.png

You can get beautiful results with the simulator.

Make a Noise Model

We will reproduce the same Noise Model as the actual machine with a simulator.

import

# matplotlib inline
from qiskit import QuantumCircuit, execute
from qiskit import IBMQ, Aer
from qiskit.visualization import plot_histogram
from qiskit.providers.aer.noise import NoiseModel

Get Noise Model from the actual machine

#Call the IBMQ account.
provider = IBMQ.load_account()
#This time ibmq_Use vigo's Noise Model
backend = provider.get_backend('ibmq_vigo')
noise_model = NoiseModel.from_backend(backend)

Let's execute the GHZ state circuit.

#Definition of quantum register
qr = QuantumRegister(3)
#Definition of quantum circuit
qc = QuantumCircuit(qr)

#Hadamard gate to 0bit
qc.h(0)
# 0bit-CNOT with 1bit
qc.cx(0, 1)
# 1bit-CNOT with 2bit
qc.cx(1, 2)

#Measure all quantum registers
qc.measure_all()

#Run
result = execute(qc, Aer.get_backend('qasm_simulator'),
                 noise_model=noise_model).result()
counts = result.get_counts()
#plot counts into a histogram
plot_histogram(counts)

Noise_GHZ_plot.png

in this way$ |000> When |111> $以外の結果も得るこWhenが出来ましたね.

Summary

There seem to be various other options, so I would like to investigate.

Recommended Posts

I want to easily create a Noise Model
I want to create a window in Python
I want to create a plug-in type implementation
I want to easily find a delicious restaurant
I want to easily implement a timeout in python
I want to easily build a model-based development environment
I want to manually create a legend with matplotlib
I want to create a Dockerfile for the time being.
I tried to create a linebot (implementation)
I want to print in a comprehension
I tried to create a linebot (preparation)
I want to build a Python environment
Qiskit: I want to create a circuit that creates arbitrary states! !!
I want to create a system to prevent forgetting to tighten the key 1
I want to create a pipfile and reflect it in docker
I want to create a machine learning service without programming! WebAPI
I want to make matplotlib a dark theme
I want to INSERT a DataFrame into MSSQL
Anyway, I want to check JSON data easily
I want to make a game with Python
If you want to create a Word Cloud.
I don't want to take a coding test
I want to write to a file with Python
I want to create a machine learning service without programming! Text classification
I want to upload a Django app to heroku
I want to create a nice Python development environment for my new Mac
I tried to create a class that can easily serialize Json in Python
I want to create a priority queue that can be updated in Python (2.7)
I tried to easily create a fully automatic attendance system with Selenium + Python
I want to create a web application that uses League of Legends data ①
I tried to create a model with the sample of Amazon SageMaker Autopilot
I want to embed a variable in a Python string
I tried to create a table only with Django
I want to iterate a Python generator many times
I want DQN Puniki to hit a home run
100 image processing knocks !! (021-030) I want to take a break ...
I want to give a group_id to a pandas data frame
I want to generate a UUID quickly (memorandum) ~ Python ~
I want to transition with a button in flask
I want to climb a mountain with reinforcement learning
I want to write in Python! (2) Let's write a test
I want to find a popular package on PyPi
I made a code to convert illustration2vec to keras model
I want to randomly sample a file in Python
I want to work with a robot in python.
I want to split a character string with hiragana
I want to install a package of Php Redis
[Python] I want to make a nested list a tuple
I want to send a business start email automatically
I want to run a quantum computer with Python
I want to bind a local variable with lambda
I want a mox generator
I want to create an API that returns a model with a recursive relationship in the Django REST Framework
I want to solve Sudoku (Sudoku)
I want a mox generator (2)
I want to create a lunch database [EP1] Django study for the first time
I want to create a lunch database [EP1-4] Django study for the first time
I tried to implement a basic Recurrent Neural Network model
I tried to automatically create a report with Markov chain
I want to easily delete columns containing NA in R
I want to make a blog editor with django admin