# Recommended noise model for QNN?

I’d like to add a noise model to a quantum transfer neural network in Pennylane.

I read the noisy circuit tutorial but I’m unsure of what noise model to use.

Are there any recommendations? Is there a generic noise model for simulating a generic noisy quantum computer?

Hey @schance995! Welcome to the forum

I’d say that depolarizing noise is a safe bet for a good “generic” / “common” type of noise. That said, you can get pretty crazy and combine all sorts of different error channels / noise as follows:

``````import pennylane as qml

dev = qml.device("default.mixed", wires=2)

@qml.qnode(dev)
@qml.transforms.insert(qml.AmplitudeDamping, 0.1, position="all")
@qml.transforms.insert(qml.DepolarizingChannel, 0.2, position="all")
def f(w, x, y, z):
qml.RX(w, wires=0)
qml.RY(x, wires=1)
qml.CNOT(wires=[0, 1])
qml.RY(y, wires=0)
qml.RX(z, wires=1)
return qml.expval(qml.PauliZ(0) @ qml.PauliZ(1))

print(qml.draw(f)(0.9, 0.4, 0.5, 0.6))
``````
``````0: ──RX(0.90)──AmplitudeDamping(0.10)──DepolarizingChannel(0.20)──AmplitudeDamping(0.10)─╭●
1: ──RY(0.40)──AmplitudeDamping(0.10)──DepolarizingChannel(0.20)──AmplitudeDamping(0.10)─╰X

───AmplitudeDamping(0.10)──DepolarizingChannel(0.20)──AmplitudeDamping(0.10)──RY(0.50)
───AmplitudeDamping(0.10)──DepolarizingChannel(0.20)──AmplitudeDamping(0.10)──RX(0.60)

───AmplitudeDamping(0.10)──DepolarizingChannel(0.20)──AmplitudeDamping(0.10)─┤ ╭<Z@Z>
───AmplitudeDamping(0.10)──DepolarizingChannel(0.20)──AmplitudeDamping(0.10)─┤ ╰<Z@Z>
``````

I took the example in the documentation for qml.transforms.insert and just added another decorator that wraps the circuit in more noise!

Let me know if this helps

Thanks @isaacdevlugt , I will look into depolarizing noise further!

1 Like

Awesome! Do respond back if you have any other questions