Python package for visualizing the loss landscape of parameterized quantum algorithms.

Related tags

Deep Learningorqviz
Overview

Image

orqviz

A Python package for easily visualizing the loss landscape of Variational Quantum Algorithms by Zapata Computing Inc.

orqviz provides a collection of tools which quantum researchers and enthusiasts alike can use for their simulations. It works with any framework for running quantum circuits, for example qiskit, cirq, pennylane, and Orquestra. The package contains functions to generate data, as well as a range of flexible plotting and helper functions. orqviz is light-weight and has very few dependencies.

Getting started

In doc/examples/ we provide a range of Jupyter notebook examples for orqviz. We have four Jupyter notebooks with tutorials for how to get started with any quantum circuit simulation framework you might use. You will find examples with qiskit, cirq, pennylane and Zapata's Orquestra library. The tutorials are not exhaustive, but they do provide a full story that you can follow along.

In this notebook we have the Sombrero example that we showcase in our paper. We also have an advanced example notebook which provides a thorough demonstration of the flexibility of the orqviz package.

We recently published a paper on arXiv where we review the tools available with orqviz:
ORQVIZ: Visualizing High-Dimensional Landscapes in Variational Quantum Algorithms

Installation

You can install our package using the following command:

pip install orqviz

Alternatively you can build the package from source. This is especially helpful if you would like to contribute to orqviz

git clone https://github.com/zapatacomputing/orqviz.git
cd orqviz
pip install -e ./

Examples

import orqviz
import numpy as np

np.random.seed(42)

def loss_function(pars):
    return np.sum(np.cos(pars))**2 + np.sum(np.sin(30*pars))**2

n_params = 42
params = np.random.uniform(-np.pi, np.pi, size=n_params)
dir1 = orqviz.geometric.get_random_normal_vector(n_params)
dir2 = orqviz.geometric.get_random_orthonormal_vector(dir1)

scan2D_result = orqviz.scans.perform_2D_scan(params, loss_function,
                                direction_x=dir1, direction_y=dir2,
                                n_steps_x=100)
orqviz.scans.plot_2D_scan_result(scan2D_result)

This code results in the following plot:

Image

Authors

The leading developer of this package is Manuel Rudolph at Zapata Computing.
For questions related to the visualization techniques, contact Manuel via [email protected] .

The leading software developer of this package is Michał Stęchły at Zapata Computing.
For questions related to technicalities of the package, contact Michał via [email protected] .

Thank you to Sukin Sim and Luis Serrano from Zapata Computing for their contributions to the tutorials.

You can also contact us or ask general questions using GitHub Discussions.

For more specific code issues, bug fixes, etc. please open a GitHub issue in the orqviz repository.

If you are doing research using orqviz, please cite our paper:

ORQVIZ: Visualizing High-Dimensional Landscapes in Variational Quantum Algorithms

How to contribute

Please see our Contribution Guidelines.

Comments
  • Use transpile to build circuit only once

    Use transpile to build circuit only once

    Despite being wrapped up in a lambda function, the get_circuit function is actually still called for every function evaluation during plot generation or optimization, and hence the circuit is rebuilt each time. This rather defeats the concept of late binding of the parameter values. The PR uses a slightly different approach using the transpile function. The code is arguably more transparent than using the lambda function wrapper. Evaluation is faster now, but for this simple case rarely more than 10%. One downside, the circuit cannot be plotted anymore in a simple way.

    opened by RonMeiburg 11
  • ci: add step with Pythonic cruft cleanup

    ci: add step with Pythonic cruft cleanup

    Apparently, issues that we had with mypy stem from Github Actions caching some (?) directories (thanks @alexjuda for pointing this out!). This PR adds a cleaning step (taken from z-quantum-actions) that deletes potentially conflicting directories.

    opened by dexter2206 1
  • Clean notebooks

    Clean notebooks

    These are the once-run versions of the cirq and qiskit notebooks derived from the 'simplified qiskit get_circuit() return' commit from the main branch. I hope this works for you. If not, then I apologize, When it comes to git I still suffer from sas every now and then.

    opened by RonMeiburg 1
  • Loss function clarity

    Loss function clarity

    Goals of this draft PR:

    • Allow parameters to be any np.ndarray rather than strictly a 1D np.ndarray
    • Improve docstrings for what we define as a loss function
    • Improve README to specify what we define as a loss function, and how to wrap their loss function with functools.partial
    • Alternatively, allow loss_function_kwargs in the scanning functions that we pass to the loss_function with more than one argument.
    opened by MSRudolph 1
  • Utilize tqdm progress bar when verbose=True during scans.

    Utilize tqdm progress bar when verbose=True during scans.

    Is your feature request related to a problem? Please describe. We should replace the print calls when verbose=True in scans with tqdm from the tqdm library. Alternatively, we make it the default and find a way to mute the library's prints.

    Describe the solution you'd like

    verbose = True  # or False
    for it in tqdm(range(n_iters), disable = not verbose):
       ...  # run scans
    

    Additional context Our verbosity options are currently very rudimentary and tqdm is one of the most used Python libraries.

    opened by MSRudolph 2
  • This repo should contain Issues for how people can contribute

    This repo should contain Issues for how people can contribute

    Is your feature request related to a problem? Please describe. Currently, when people enter the orqviz GitHub repository with the intent to contribute, there are no open Issues and not many PRs. They will not know what might be low-hanging fruit to contribute.

    Describe the solution you'd like We (orqviz developers) should open Issues which are connected to how people can concretely contribute. For example, we could provide links to existing tutorials which we believe can be readily enhanced with our visualization techniques. In such cases, potential contributors could work on such enhancements and reach out to the authors of the original tutorials. Similarly, we can elaborate on future visualization techniques which we could experiment with. This may be done by external contributors.

    opened by MSRudolph 0
Releases(v0.3.0)
  • v0.3.0(Aug 19, 2022)

    What's Changed

    • ci: add step with Pythonic cruft cleanup by @dexter2206 in https://github.com/zapatacomputing/orqviz/pull/43
    • Update main by @mstechly in https://github.com/zapatacomputing/orqviz/pull/44
    • Fourier transform by @laurgao in https://github.com/zapatacomputing/orqviz/pull/45

    Full Changelog: https://github.com/zapatacomputing/orqviz/compare/v0.2.0...v0.3.0

    Source code(tar.gz)
    Source code(zip)
    orqviz-0.3.0-py3-none-any.whl(38.09 KB)
  • v0.2.0(Feb 8, 2022)

    New features:

    • orqviz now doesn't require parameters to be 1D vectors, they can be ND arrays instead
    • We introduced LossFunctionWrapper as a utility tool that helps with changing arbitrary python functions into orqviz-compatible loss functions.

    Minor changes:

    • Improvements in notebook examples
    • Improvements in readme and contribution guidelines
    Source code(tar.gz)
    Source code(zip)
  • v0.1.1(Nov 9, 2021)

    What's Changed

    • Fixed classifiers in the setup.cfg
    • Minor fixes in in README
    • Relax dependency versions

    Full Changelog: https://github.com/zapatacomputing/orqviz/compare/v0.1.0...v0.1.1

    Source code(tar.gz)
    Source code(zip)
Owner
Zapata Computing, Inc.
Zapata Computing, Inc.
Build a medical knowledge graph based on Unified Language Medical System (UMLS)

UMLS-Graph Build a medical knowledge graph based on Unified Language Medical System (UMLS) Requisite Install MySQL Server 5.6 and import UMLS data int

Donghua Chen 6 Dec 25, 2022
A PyTorch implementation: "LASAFT-Net-v2: Listen, Attend and Separate by Attentively aggregating Frequency Transformation"

LASAFT-Net-v2 Listen, Attend and Separate by Attentively aggregating Frequency Transformation Woosung Choi, Yeong-Seok Jeong, Jinsung Kim, Jaehwa Chun

Woosung Choi 29 Jun 04, 2022
robomimic: A Modular Framework for Robot Learning from Demonstration

robomimic [Homepage]   [Documentation]   [Study Paper]   [Study Website]   [ARISE Initiative] Latest Updates [08/09/2021] v0.1.0: Initial code and pap

ARISE Initiative 178 Jan 05, 2023
Pytorch implement of 'Unmixing based PAN guided fusion network for hyperspectral imagery'

Pgnet There's a improved version compared with the publication in Tgrs with the modification in the deduction of the PDIN block: https://arxiv.org/abs

5 Jul 01, 2022
Nicely is a real-time Feedback and Intervention Program Depression is a prevalent issue across all age groups, socioeconomic classes, and cultural identities.

Nicely is a real-time Feedback and Intervention Program Depression is a prevalent issue across all age groups, socioeconomic classes, and cultural identities.

1 Jan 16, 2022
Lyapunov-guided Deep Reinforcement Learning for Stable Online Computation Offloading in Mobile-Edge Computing Networks

PyTorch code to reproduce LyDROO algorithm [1], which is an online computation offloading algorithm to maximize the network data processing capability subject to the long-term data queue stability an

Liang HUANG 87 Dec 28, 2022
Image process framework based on plugin like imagej, it is esay to glue with scipy.ndimage, scikit-image, opencv, simpleitk, mayavi...and any libraries based on numpy

Introduction ImagePy is an open source image processing framework written in Python. Its UI interface, image data structure and table data structure a

ImagePy 1.2k Dec 29, 2022
Face detection using deep learning.

Face Detection Docker Solution Using Faster R-CNN Dockerface is a deep learning face detector. It deploys a trained Faster R-CNN network on Caffe thro

Nataniel Ruiz 181 Dec 19, 2022
dataset for ECCV 2020 "Motion Capture from Internet Videos"

Motion Capture from Internet Videos Motion Capture from Internet Videos Junting Dong*, Qing Shuai*, Yuanqing Zhang, Xian Liu, Xiaowei Zhou, Hujun Bao

ZJU3DV 98 Dec 07, 2022
NeuralCompression is a Python repository dedicated to research of neural networks that compress data

NeuralCompression is a Python repository dedicated to research of neural networks that compress data. The repository includes tools such as JAX-based entropy coders, image compression models, video c

Facebook Research 297 Jan 06, 2023
STRIVE: Scene Text Replacement In Videos

STRIVE: Scene Text Replacement In Videos Dataset Types: RoboText SynthText RealWorld videos RoboText : Videos of texts collected using navigation robo

15 Jul 11, 2022
Emotion classification of online comments based on RNN

emotion_classification Emotion classification of online comments based on RNN, the accuracy of the model in the test set reaches 99% data: Large Movie

1 Nov 23, 2021
Official implementation for the paper: Multi-label Classification with Partial Annotations using Class-aware Selective Loss

Multi-label Classification with Partial Annotations using Class-aware Selective Loss Paper | Pretrained models Official PyTorch Implementation Emanuel

99 Dec 27, 2022
A model that attempts to learn and benefit from data collected on card counting.

A model that attempts to learn and benefit from data collected on card counting. A decision tree like model is built to win more often than loose and increase the bet of the player appropriately to c

1 Dec 17, 2021
Reimplementation of the paper `Human Attention Maps for Text Classification: Do Humans and Neural Networks Focus on the Same Words? (ACL2020)`

Human Attention for Text Classification Re-implementation of the paper Human Attention Maps for Text Classification: Do Humans and Neural Networks Foc

Shunsuke KITADA 15 Dec 13, 2021
Code for ICCV 2021 paper "HuMoR: 3D Human Motion Model for Robust Pose Estimation"

Code for ICCV 2021 paper "HuMoR: 3D Human Motion Model for Robust Pose Estimation"

Davis Rempe 367 Dec 24, 2022
The 3rd place solution for competition

The 3rd place solution for competition "Lyft Motion Prediction for Autonomous Vehicles" at Kaggle Team behind this solution: Artsiom Sanakoyeu [Homepa

Artsiom 104 Nov 22, 2022
A PyTorch Image-Classification With AlexNet And ResNet50.

PyTorch 图像分类 依赖库的下载与安装 在终端中执行 pip install -r -requirements.txt 完成项目依赖库的安装 使用方式 数据集的准备 STL10 数据集 下载:STL-10 Dataset 存储位置:将下载后的数据集中 train_X.bin,train_y.b

FYH 4 Feb 22, 2022
ALL Snow Removed: Single Image Desnowing Algorithm Using Hierarchical Dual-tree Complex Wavelet Representation and Contradict Channel Loss (HDCWNet)

ALL Snow Removed: Single Image Desnowing Algorithm Using Hierarchical Dual-tree Complex Wavelet Representation and Contradict Channel Loss (HDCWNet) (

Wei-Ting Chen 49 Dec 27, 2022
OCR Post Correction for Endangered Language Texts

📌 Coming soon: an update to the software including features from our paper on semi-supervised OCR post-correction, to be published in the Transaction

Shruti Rijhwani 96 Dec 31, 2022