Skip to content
This repository has been archived by the owner on Aug 21, 2023. It is now read-only.

Commit

Permalink
Fixes Aqua notebooks for upcoming Aqua 0.6 Release (#778)
Browse files Browse the repository at this point in the history
* switch from BasicAer to LegacySimulators

* Eliminate paulis_grouping

* update the tutorial to register a component/algorithm

* Fix grover input file

* Change from qiskit_aqua to qiskit.aqua and from qiskit_chemistry to qiskit.chemistry

* Add run_config to some notebooks

* Remove LegacySimulators

* Remove get_aer_backend and arr run_config

* Remove get_aer_backend and add run_config

* fix the format of entangler_map

* Update h2_uccsd to latest chemistry/aqua

* Update ExactEigensolver valid dictionaries

* Shots defaults for statevector_simulator

* add example: 3-Coloring oracle by reduction to SAT

* minor edits

* remove period

* Remove RunConfig from QuantumInstance parameters

* remove cnf - its str content will be used directly

* Update grover.ipynb

* minor edit

* Change get_input_instance to get_pluggable_class

* Change set_aqua_logging to set_qiskit_aqua_logging

* Fixed grover input file

* Add Aqua tutorial solving linear systems of equation with HHL

* Fix Hamiltonian run return values

* random_distributions was renamed to uncertainty_models

* add arbitrary logic expr and truth table examples

* LogicExpressionOracle -> LogicalExpressionOracle

* moo -> moot

* Tutorial for variational algo optimization callback

* remove circuit_caching=False flags

* minor edits

* minor edit

* Update for latest hhl & ExactLPsolver

* Update Aqua general tutorials

* Notebook was refactored/renamed

* initial commit for new qiskit finance folder structure

* reintroduce fidelity and probability output

* added docplex.ipynb and added docplex parts into an exisitng maxcut_and_tsp.ipynb

* Added header and removed error examples. Fixed the problem name

* random number generator notebook

* new random generator

* minor improvements

* Moving the drivers to tutorials

* update ExactLSsolver naming

* Deprecation of warnings, addition of outputs

* Minor spelling and text fixups

* A simple tutorial for the Qiskit Finance data loading

* Updates to the random variates notebook

* A bugfix

* move finance tutorials to qiskit / finance and add new tutorials as well

* Create execute_qgan.ipynb

* Time series tutorial

* Minor improvements

* streamline all tutorials

* notebooks qgans

* update

* add HHL truncate parameters

* improve HHL example and clean up

* update results

* fix

* text update

* Noisy simulation with AER on Aqua

* Fix Grover input file

* delete files

* Create qgans_for_loading_random_distributions.ipynb

* Contributing the time_series, portfolio_diversification, and generating_random_variates notebooks.

* update qgan tutorials

* update qiskit finance index page

* bug fix in amplitude estimation tutorial

* update portfolio optimization and qiskit finance index

* Update portfolio_optimization.ipynb

* add notebook for deutsch-jozsa

* add notebook for bernstein-vazirani

* add notebook for simon's

* add notebook for shor's

* Change seed_mapper to seed_transpiler

* merge PR

* edit notebooks after VQC refactor

* switch BasicAer -> Aer

* switch back Aer -> BasicAer

* minor edits on wording

* Updates to chemistry notebooks

* Update chemistry notebooks

* more updates for vqc refactor

* Update optimization notebooks

* adjust tutorials index

* along with qiskit-community/qiskit-aqua#496

* Added random data

* Updated portfolio diversification to the current master branch

* Updated generation of random variates

* update qiskit tutorials and qiskit finance index

* merge use of time series

* rerun all notebooks with fetched terra / aqua

* The vehicle routing notebook

* Update portfolio_diversification.ipynb

* running optimization notebooks with fetched aqua / terra

* delete empty readmes

* For the updated Qiskit Aqua (as of April 30th)

* use data provider in portfolio optimization and rerun all notebooks with most recent aqua/terra

* update qgan notebooks

* Update time_series.ipynb

* Mover domain folders like chemistry, ai etc out of aqua as peers

* Update index to reflect chem, ai, opt folder moves

* Update section numbers for Aqua domains

* Re-ran notebook to remove old warning

* add notebook for vqc comparing feature maps

* Update the notebbooks

* add finance notebooks to community section and adjust indices where necessary

* update aqua community index

* add qgan tutorials and update corresponding indices

* Edits

* split into featured, community, and qiskit tutorials

* Update qGAN notebooks with a Numpy based Discriminator

* Use IBMQ v2 api and QuantumInstance seed_simulator parameter

* change qiskit_aqua import to qiskit.aqua

* Fix picture relative path

* Use Z2Symmetries static method

* fix aqua how to

* update usage based no aqua0.6's change

* Revert "split into featured, community, and qiskit tutorials"

This reverts commit 59dac5c.

* sync with aqua 0.6 branch

* updating references in finance tutorials
  • Loading branch information
manoelmarques authored and jaygambetta committed Aug 21, 2019
1 parent 32ed3ce commit 0854ffc
Show file tree
Hide file tree
Showing 22 changed files with 546 additions and 652 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"source": [
"from qiskit import BasicAer\n",
"import numpy as np\n",
"from qiskit.aqua.operator import Operator\n",
"from qiskit.aqua.operators import MatrixOperator, op_converter\n",
"from qiskit.aqua import local_pluggables, PluggableType"
]
},
Expand All @@ -95,7 +95,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"['QAOA.Variational', 'VQC', 'VQE', 'ExactEigensolver', 'ExactLSsolver', 'SVM', 'EOH', 'QSVM', 'AmplitudeEstimation', 'BernsteinVazirani', 'DeutschJozsa', 'Grover', 'HHL', 'IQPE', 'QPE', 'Shor', 'Simon', 'EvolutionFidelity']\n"
"['QAOA.Variational', 'QGAN', 'VQC', 'VQE', 'ExactEigensolver', 'ExactLSsolver', 'SVM', 'EOH', 'QSVM', 'AmplitudeEstimation', 'BernsteinVazirani', 'DeutschJozsa', 'Grover', 'HHL', 'IQPE', 'QPE', 'Shor', 'Simon', 'EOM_EE', 'EOM_VQE', 'EvolutionFidelity']\n"
]
}
],
Expand All @@ -116,11 +116,18 @@
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Convert from a MatrixOperator to a Pauli-type Operator requires exponential time. You can turn on DEBUG logging to check the progress.\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"0.934847761060059\n"
"0.9597914987731967\n"
]
}
],
Expand All @@ -130,7 +137,7 @@
"from qiskit.aqua import QuantumInstance\n",
"num_qubits = 2\n",
"temp = np.random.random((2 ** num_qubits, 2 ** num_qubits))\n",
"qubit_op = Operator(matrix=temp + temp.T)\n",
"qubit_op = op_converter.to_weighted_pauli_operator(MatrixOperator(matrix=temp + temp.T))\n",
"\n",
"initial_state = Zero(qubit_op.num_qubits)\n",
"\n",
Expand Down Expand Up @@ -185,7 +192,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"0.9348477610600592\n"
"0.9597914987731967\n"
]
}
],
Expand All @@ -197,9 +204,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Quantum (Dev)",
"language": "python",
"name": "python3"
"name": "quantum-dev"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -212,35 +219,6 @@
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
},
"varInspector": {
"cols": {
"lenName": 16,
"lenType": 16,
"lenVar": 40
},
"kernels_config": {
"python": {
"delete_cmd_postfix": "",
"delete_cmd_prefix": "del ",
"library": "var_list.py",
"varRefreshCmd": "print(var_dic_list())"
},
"r": {
"delete_cmd_postfix": ") ",
"delete_cmd_prefix": "rm(",
"library": "var_list.r",
"varRefreshCmd": "cat(var_dic_list()) "
}
},
"types_to_exclude": [
"module",
"function",
"builtin_function_or_method",
"instance",
"_Feature"
],
"window_display": false
}
},
"nbformat": 4,
Expand Down
8 changes: 4 additions & 4 deletions qiskit/advanced/aqua/amplitude_estimation.ipynb

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"### [Optional] Setup token to run the experiment on a real device\n",
"If you would like to run the experiement on a real device, you need to setup your account first.\n",
"\n",
"Note: If you do not store your token yet, use `IBMQ.save_accounts()` to store it first."
"Note: If you do not store your token yet, use `IBMQ.save_account('MY_API_TOKEN')` to store it first."
]
},
{
Expand All @@ -76,7 +76,7 @@
"outputs": [],
"source": [
"# from qiskit import IBMQ\n",
"# IBMQ.load_accounts()"
"# provider = IBMQ.load_account()"
]
},
{
Expand Down Expand Up @@ -173,7 +173,7 @@
"qsvm = QSVM(feature_map, training_input, test_input, datapoints[0])\n",
"\n",
"backend = BasicAer.get_backend('qasm_simulator')\n",
"quantum_instance = QuantumInstance(backend, shots=1024, seed=seed, seed_transpiler=seed)\n",
"quantum_instance = QuantumInstance(backend, shots=1024, seed_simulator=seed, seed_transpiler=seed)\n",
"\n",
"result = qsvm.run(quantum_instance)\n",
"\n",
Expand Down Expand Up @@ -279,7 +279,7 @@
"qsvm = QSVM(feature_map, training_input, test_input)\n",
"\n",
"backend = BasicAer.get_backend('qasm_simulator')\n",
"quantum_instance = QuantumInstance(backend, shots=1024, seed=seed, seed_transpiler=seed)\n",
"quantum_instance = QuantumInstance(backend, shots=1024, seed_simulator=seed, seed_transpiler=seed)\n",
"\n",
"result = qsvm.run(quantum_instance)\n",
"\n",
Expand Down
6 changes: 3 additions & 3 deletions qiskit/advanced/aqua/chemistry/declarative_approach.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"### [Optional] Setup token to run the experiment on a real device\n",
"If you would like to run the experiement on a real device, you need to setup your account first.\n",
"\n",
"Note: If you have not stored your token yet, use `IBMQ.save_accounts()` to store it first."
"Note: If you have not stored your token yet, use `IBMQ.save_account('MY_API_TOKEN')` to store it first."
]
},
{
Expand All @@ -78,8 +78,8 @@
"outputs": [],
"source": [
"# from qiskit import IBMQ\n",
"# IBMQ.load_accounts()\n",
"# backend = IBMQ.get_backend('ibmq_16_melbourne')"
"# provider = IBMQ.load_account()\n",
"# backend = provider.get_backend('ibmq_16_melbourne')"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
"### [Optional] Setup token to run the experiment on a real device\n",
"If you would like to run the experiement on a real device, you need to setup your account first.\n",
"\n",
"Note: If you do not store your token yet, use `IBMQ.save_accounts()` to store it first."
"Note: If you do not store your token yet, use `IBMQ.save_account('MY_API_TOKEN')` to store it first."
]
},
{
Expand All @@ -144,7 +144,7 @@
"outputs": [],
"source": [
"# from qiskit import IBMQ\n",
"# IBMQ.load_accounts()"
"# provider = IBMQ.load_account()"
]
},
{
Expand Down
Loading

0 comments on commit 0854ffc

Please sign in to comment.