Hi Maria @Maria_Schuld,
Here is my question: where does the nonlinearity come from in QNN? My understanding is that:
- Feature embedding layer introduces nonlinearity.
- Unentangled parametrical gates do not introduce any nonlinearity, is this right?
- Entangling is nonlinear. But can it involve strong nonlinearity? Let’s say, by simply adopting several StronglyEntanglingLayers, is it possible to mimic a strongly nonlinear boundary in classification?
- Measurements introduce nonlinearity. I see this in papers but actually I didn’t understand the logic.
I would really appreciate it if you could briefly explain, or guide me to some referefences. Thanks in advance! 
Hey @zhouyf10, and thanks for migrating the question to a new thread!
I assume you mean nonlinearity of the QML model (say, the expectation of a variational circuit + measurement) in the data, right?
Let’s be precise and go through each step. If you embed inputs, creating a quantum state |\phi(x) \rangle, then the amplitudes \phi_i = \langle i | \phi(x)\rangle are in general nonlinear in x, yes. The obvious exception would be AmplitudeEmbedding
, which is designed so that the amplitudes are the inputs.
If you then do some more unitary evolution, for example by applying a parametrized circuit U(\theta), the amplitudes of the new state |\phi'(x) \rangle = U(\theta)| \phi(x) \rangle will be linear in the amplitudes of |\phi(x) \rangle (that’s trivial, since U is a linear operation on the state vector). So any standard computation after the embedding does not add nonlinearity, which means that embedded inputs have the same distance to each other before and after U is applied. Whether there is entanglement or not does not play a role at all.
Finally, the measurement will again introduce a “slight” (quadratic) nonlinearity in the amplitudes of the final state: \langle \phi'(x)| M|\phi'(x) \rangle = \sum_{ij} M_{ij} \phi'_i(x) \phi'_j(x).
In this sense one can say that the source of nonlinearity with regards to the inputs is only the embedding and the measurement. But obviously a parametrized gate like a Pauli rotation produces a state which is nonlinear in the parameters. So a sentence like “xyz is (non)linear” only makes sense if we state what object is (non)linear in what variable…
Hope this helps?
3 Likes
Thanks Maria @Maria_Schuld ! That really helps. A following-up question is that does the nonlinearity in parameters make sense for ML? Since ML looks for a mapping from input features x to output y, using of course the parameterized blocks (neurons or gates), I feel only the nonlinearity in x contributes. Please correct me if I am wrong. Thank you.
Yes, the nonlinearity in the parameters will have a more severe effect on the training landscape than the class of models one can learn…
1 Like
Hi @Maria_Schuld, This post might be old. but I am trying to collect some references on what you have explained in this comment, could you provide any?
I ask specifically about nonlinearity sources in QML models you have mentioned (Input encoding, and measurements, and Pauli parameterized gate).
Also, regarding "
But obviously a parametrized gate like a Pauli rotation produces a state which is **nonlinear in the parameters", does this apply on any parameterized gate? as example if I use any other rotational gate?
Thanks
Hi, @deen_omailnoth! Welcome to the forum.
About the parametrized Pauli rotation, I can provide an example to make it clearer so you can think of other instances where this situation applies.
Imagine starting at the state |0\rangle and apply a parametrized rotation to it, like RX(\theta), giving |\psi (\theta)\rangle=RX(\theta)|0\rangle=\cos(\theta/2)|0\rangle-i\sin(\theta/2)|1\rangle. Which produces a state that is nonlinear in the parameter \theta since the probability amplitudes (\cos(\theta/2), -i\sin(\theta/2)), also the probabilities, associated to the basis states are not linear functions of \theta.
On an additional note, I think Maria’s comment was more an explanation of how different elements of a QML model, like the amplitudes of the quantum state in the embedding step, include a nonlinear dependence on different parameters. Those three things you mention in your question: input encodings, measurements and a Pauli parametrized gate are not exclusive to QML and here were just stating how they interact in a QML model.
Let us know if you have any further questions.
Hi @daniela.murcillo! thanks for your answer!
I appreciate your further example. However, I was asking on a reference (A research paper on these points) and I assume also it does not need to be related to QML. I was able to find some reference related to Feature Mapping and non-linearity, but I am struggling to find it when it comes to measurements as example. My assumption was that the points mentioned in @Maria_might be based on books/research articles, and that’s why I asked for related references.
Thanks again!
Hi @deen_omailnoth ,
I noticed that our demo on the Data Reuploading Classifier mentions nonlinear collapse. Let us know if this is what you were looking for!
We also have mentions of nonlinearity in other PennyLane resources. I hope this helps!