Extending single variable regresion tutorial to multi variable

HI All,
i am trying to convert the single variable regression tutorial provided to multivariable regression problem. given 4 input variables, the NN model should predict a continuous value . i am new to designing circuits on quantum . i guess I have to use 4 wires but I don’t know what gates to add to them to achieve my required result. pls, help with getting started for multivariable regression models.

this is the tutorial I was referring to https://pennylane.ai/qml/demos/quantum_neural_net.html

thanks
yuvaram

Hi @yuvaramsingh,

Welcome to the forum!

It sounds like you are on the right track :slight_smile: If you have more variables, yes you’ll need more wires. It doesn’t necessarily have to be 4 - there are different ways to encode, or embed input data into a quantum circuit. PennyLane includes a couple methods already built in in our templates. In the specific tutorial you linked, the Displacement gate is being used for this purpose. So a good place to start would indeed be to use 4 wires, and then for each input variable, assign it to a qubit, and displace that qubit by the input amount.

In terms of what gates to apply, you’ll need to choose a model, or ansatz circuit for the network. The circuit in the tutorial is a single-mode version of the more general CVNeuralNetLayers, so I’d recommend giving that a go.

As a final point, the model in the tutorial is a continuous-variable model; you could also check out qubit-based models. The variational classifier tutorial gives a similar example with a qubit system that may be useful to explore.

Hope that helps, please let us know if you have any further questions!

thanks for the quick reply . let me try your suggestion.