-
Notifications
You must be signed in to change notification settings - Fork 577
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
TF Quantum Starter Example #393
base: master
Are you sure you want to change the base?
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
So most of this code looks to be copied from our already existing notebook at https://github.com/tensorflow/quantum/blob/research/binary_classifier/binary_classifier.ipynb |
That's right, this is inspired from that notebook, I built this as a simplification to the existing one, to make it a lot easier for beginners to understand. |
I think we might be able to fit this in as a tutorial, right after the hello many worlds and before the MNIST classification tutorial. The goal of our tutorials is to showcase the functionality and features of the library so that experts have an easy time making the mental connections between how TFQ functions and QC theory (which we generally expect people to have a strong grasp of). Even though this is a more "beginner" example and doesn't touch any new library code that hello many worlds doesn't already touch, I think showcasing good visualizations of the single qubit rotation problem might give experts a little more opportunity to connect with and understand how TFQ works. (I think ultimately this means moving that particular example out of research and into tutorials @zaqqwerty ) @lamberta Are you alright if I give this a review and then hand off to you for final say ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of thematic and large changes I think we need here, before we go into a more serious review would be:
-
If this is going to be a more beginner oriented tutorial we should be sure to include the appropriate descriptions of all the processes in the notebook and do our best to explain every step of what is going on. Throughout the notebook things are a little bit unclear. Ideally after the user is done reading the tutorial, they shouldn't have many questions like: Why are we placing a qubit and rotating it in this way ? Why is the shape of the labels array [2,2] ? what does a label of 1 vs 0 mean ? An effort should be made to leave the user with as few of these kinds of questions as possible (since this is a beginner tutorial this is going to be especially tricky and important).
-
The length of this tutorial is very short. We create the circuit, generate the data, train the model show a graph and then we are done. To help beginners we should definitely showcase some more math and make sure we firm up understanding for them at every step. For example, a good spot in the tutorial I think would benefit from having more detail is the data preparation section. Instead of making 2 datapoints, make 2,000 and then visualize them like we did in the research tutorial this is based on. You could also show some math like "here are the polar coordinates for this particular datapoint. You can see that because the qubit is rotated in this way it's label is this...." etc.
Overall, this is a good first step, but we will need to build things up a fair bit more if we are going to get it ready to showcase as a tutorial.
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Getting started with [TensorFlow Quantum](https://www.tensorflow.org/quantum)\n", | ||
"\n", | ||
"_Notebook orignially contributed by: [Rishit-dagli](https://github.com/Rishit-dagli)_\n", | ||
"\n", | ||
"<table class=\"tfo-notebook-buttons\" align=\"left\">\n", | ||
" <td>\n", | ||
" <a target=\"_blank\" href=\"https://colab.research.google.com/github.com/tensorflow/quantum/blob/master/docs/tutorials/tf_quantum_starter.ipynb\"><img src=\"https://www.tensorflow.org/images/colab_logo_32px.png\" />Run in Google Colab</a>\n", | ||
" </td>\n", | ||
" <td>\n", | ||
" <a target=\"_blank\" href=\"https://github.com/tensorflow/quantum/blob/master/docs/tutorials/tf_quantum_starter.ipynb\"><img src=\"https://www.tensorflow.org/images/GitHub-Mark-32px.png\" />View source on GitHub</a>\n", | ||
" </td>\n", | ||
"</table>" | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please be sure and follow the same format used in all of the other notebook headers. If this is going to be rendered on the websites tutorial page it does not need a self link to tensorflow.org/quantum
. You also shouldn't include a link to your own personal github page.
Thanks, @MichaelBroughton |
Not yet added links for downloadable version of the notebook and a link to the TensorFlow tutorial
Thanks, @MichaelBroughton These points make sense and I will start working on them.
Thanks, @lamberta
This is something I need to be mindful of while making changes and maybe could change the tone of the tutorial since this tutorial was originally made for a talk I gave at a TensorFlow User Group where some folks were practitioners and was made to help them out too. |
Add a TF Quantum example for beginners to get started with TF Quantum. The notebook demonstrates the following pretty simple operations-
I am aware that the tutorial hello_many_worlds exists which is a beginner tutorial however, this tutorial has different aims.
This PR was originally created on tensorflow/examples#244 ported to this repo as suggested by @lamberta .