-
Notifications
You must be signed in to change notification settings - Fork 617
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Equivalent 'plot distribution' functionality similar to qiskit implemented for PennyLane for quick circuit probability outputs. #5193
Comments
As I stated in the thread I would like to work on this if consensus is established that this would be a desirable feature if implemented |
Thanks @JustinWoodring for posting, we definitely appreciate feature requests and subsequent code contributions. In this case, I'd first like to understand a little more about the motivations for this feature. One option is to use We've generally tried to steer away from providing convenience wrappers, especially around Matplotlib, because it can limit the ability for users to customize their plot and it can also generate more work in testing. One thing we could do is have a how-to guide (e.g., here) focused around all of the things you can do with visualization in PennyLane. |
The main motivation is certainly convenience. In my opinion this provides a simple way to way rapidly visualize the results. Although there are slower more manual means of creating these charts, a fast visual is very useful to reduce the work especially while prototyping an algorithm, where work is focused more on the general outcome and less on the exact visual presentation of the outcome. To clarify this isn't something to reduce users' ability to plot but rather a simple, quick way to get a probability distribution that is properly labeled and sized without the need for manual engineering of a plot. A how-to guide could potentially be adequate. Obviously I'll leave that decision to your discretion. |
Thanks for the extra context @JustinWoodring. If you have a QNode that already returns a probability distribution with However, if you have a QNode that returns something else (e.g., an expectation value), but you quickly want to look at the probabilities, then perhaps a For now, a strong how-to guide that covers visualization functionality might actually be quite a value-add for users. If you're interested in contributing that then we can definitely talk more, but no worries if not! |
I second Tom's idea that a how-to guide around visualizations would be great. |
I'd be happy to contribute a how-to guide! I think even something as simple as that could very helpful for pennylane novices looking to interpret results efficiently. :) |
Awesome @JustinWoodring! We look forward to seeing your guide. |
@JustinWoodring as a guide for writing this how-to, make sure to read this PR description. It will give you a lot of insights on what we would expect from a how-to. You can take this demo as an example! I hope these resources help you. |
Feature details
Users of qiskit will recognize that the 'plot_distribution' functionality represents a convenient way to visualize circuit output probabilities with minimal configuration.
Similar to how draw_mpl automatically outputs a circuit diagram in PennyLane, equivalent functionality for plotting probability distributions based on the qml probs output for a circuit would be very convenient.
I would like to implement this feature myself but I wanted to get a consensus on whether this would be a wanted or accepted feature before I begin the work.
Implementation
I believe that creating a function for
qml.plot_probabilities(circuit)
or something similar which takes the output of a circuit return qml.probs() would be a good way to implement this but there are perhaps better ways.How important would you say this feature is?
1: Not important. Would be nice to have.
Additional information
https://docs.quantum.ibm.com/api/qiskit/qiskit.visualization.plot_distribution
The text was updated successfully, but these errors were encountered: