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.
👨‍💻 run nanosaur in simulation with Gazebo/Ingnition

🦕 👨‍💻 nanosaur_gazebo nanosaur The smallest NVIDIA Jetson dinosaur robot, open-source, fully 3D printable, based on ROS2 & Isaac ROS. Designed & ma

nanosaur 9 Jul 19, 2022
My personal code and solution to the Synacor Challenge from 2012 OSCON.

Synacor OSCON Challenge Solution (2012) This repository contains my code and solution to solve the Synacor OSCON 2012 Challenge. If you are interested

2 Mar 20, 2022
PRTR: Pose Recognition with Cascade Transformers

PRTR: Pose Recognition with Cascade Transformers Introduction This repository is the official implementation for Pose Recognition with Cascade Transfo

mlpc-ucsd 133 Dec 30, 2022
Code release for "Transferable Semantic Augmentation for Domain Adaptation" (CVPR 2021)

Transferable Semantic Augmentation for Domain Adaptation Code release for "Transferable Semantic Augmentation for Domain Adaptation" (CVPR 2021) Paper

66 Dec 16, 2022
Main repository for the HackBio'2021 Virtual Internship Experience for #Team-Greider ❤️

Hello 🤟 #Team-Greider The team of 20 people for HackBio'2021 Virtual Bioinformatics Internship 💝 🖨️ 👨‍💻 HackBio: https://thehackbio.com 💬 Ask us

Siddhant Sharma 7 Oct 20, 2022
[3DV 2021] Channel-Wise Attention-Based Network for Self-Supervised Monocular Depth Estimation

Channel-Wise Attention-Based Network for Self-Supervised Monocular Depth Estimation This is the official implementation for the method described in Ch

Jiaxing Yan 27 Dec 30, 2022
code and models for "Laplacian Pyramid Reconstruction and Refinement for Semantic Segmentation"

Laplacian Pyramid Reconstruction and Refinement for Semantic Segmentation This repository contains code and models for the method described in: Golnaz

55 Jun 18, 2022
This is a simple backtesting framework to help you test your crypto currency trading. It includes a way to download and store historical crypto data and to execute a trading strategy.

You can use this simple crypto backtesting script to ensure your trading strategy is successful Minimal setup required and works well with static TP a

Andrei 154 Sep 12, 2022
Python package for visualizing the loss landscape of parameterized quantum algorithms.

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

Zapata Computing, Inc. 75 Dec 30, 2022
Model that predicts the probability of a Twitter user being anti-vaccination.

stylebody {text-align: justify}/style AVAXTAR: Anti-VAXx Tweet AnalyzeR AVAXTAR is a python package to identify anti-vaccine users on twitter. The

10 Sep 27, 2022
Posterior predictive distributions quantify uncertainties ignored by point estimates.

Posterior predictive distributions quantify uncertainties ignored by point estimates.

DeepMind 177 Dec 06, 2022
LiDAR Distillation: Bridging the Beam-Induced Domain Gap for 3D Object Detection

LiDAR Distillation Paper | Model LiDAR Distillation: Bridging the Beam-Induced Domain Gap for 3D Object Detection Yi Wei, Zibu Wei, Yongming Rao, Jiax

Yi Wei 75 Dec 22, 2022
GitHub repository for the ICLR Computational Geometry & Topology Challenge 2021

ICLR Computational Geometry & Topology Challenge 2022 Welcome to the ICLR 2022 Computational Geometry & Topology challenge 2022 --- by the ICLR 2022 W

42 Dec 13, 2022
A simple python stock Predictor

Python Stock Predictor A simple python stock Predictor Demo Run Locally Clone the project git clone https://github.com/yashraj-n/stock-price-predict

Yashraj narke 5 Nov 29, 2021
Code release for Convolutional Two-Stream Network Fusion for Video Action Recognition

Convolutional Two-Stream Network Fusion for Video Action Recognition

Christoph Feichtenhofer 676 Dec 31, 2022
4th place solution for the SIGIR 2021 challenge.

SIGIR-2021 (Tinkoff.AI) How to start Download train and test data: https://sigir-ecom.github.io/data-task.html Place it under sigir-2021/data/. Run py

Tinkoff.AI 4 Jul 01, 2022
这是一个yolo3-tf2的源码,可以用于训练自己的模型。

YOLOV3:You Only Look Once目标检测模型在Tensorflow2当中的实现 目录 性能情况 Performance 所需环境 Environment 文件下载 Download 训练步骤 How2train 预测步骤 How2predict 评估步骤 How2eval 参考资料

Bubbliiiing 68 Dec 21, 2022
[NeurIPS 2021] PyTorch Code for Accelerating Robotic Reinforcement Learning with Parameterized Action Primitives

Robot Action Primitives (RAPS) This repository is the official implementation of Accelerating Robotic Reinforcement Learning via Parameterized Action

Murtaza Dalal 55 Dec 27, 2022
Improving Factual Completeness and Consistency of Image-to-text Radiology Report Generation

Improving Factual Completeness and Consistency of Image-to-text Radiology Report Generation The reference code of Improving Factual Completeness and C

46 Dec 15, 2022
A wrapper around SageMaker ML Lineage Tracking extending ML Lineage to end-to-end ML lifecycles, including additional capabilities around Feature Store groups, queries, and other relevant artifacts.

ML Lineage Helper This library is a wrapper around the SageMaker SDK to support ease of lineage tracking across the ML lifecycle. Lineage artifacts in

AWS Samples 12 Nov 01, 2022