PennyLaneAI / pennylane

PennyLane is a cross-platform Python library for quantum computing, quantum machine learning, and quantum chemistry. Train a quantum computer the same way as a neural network.
https://pennylane.ai
Apache License 2.0
2.25k stars 584 forks source link

Implement optimizers based on "Quantum circuit structure learning" paper #223

Closed co9olguy closed 4 years ago

co9olguy commented 5 years ago

The paper "Quantum circuit structure learning" proposes two new algorithms for optimizing parameterized quantum circuits, Rotosolve and Rotoselect.

These work by recognizing that, if all other parameters are frozen, then the optimum value of a single parameter can be written as a simple sine function, with terms determined by certain circuit evaluations at shifted parameters. Thus, one can "jump" directly to a minimum by inverting a simple equation. The drawback is that you only update one parameter at a time.

These algorithms seem very straightforward, and could possibly be coded up as separate Optimizer classes within PennyLane (though I haven't 100% worked out if any changes would needed to other parts of the codebase). This might make a good community PR!

(suggested by @willzeng :) )

AroosaIjaz commented 5 years ago

I agree. I would love to contribute to this effort

johannesjmeyer commented 5 years ago

After having had a look at the paper I think that this only works for VQC. If the objective function is a more complicated function of the inputs I don't see how to implement that approach, essentially because it is gradient free and just minimizes the expectation of the circuit. But in general optimization this must not give the optimal cost.

angusjlowe commented 4 years ago

I'm currently working on a tutorial for these algorithms; hopefully it can serve as a guide for implementing them as optimizer classes or something similar. As long as the cost function is a linear sum of expectations I think they work fine.

josh146 commented 4 years ago

This is now implemented over at https://pennylane.ai/qml/app/tutorial_rotoselect.html