Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/tutorials/mnist.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@
"\n",
"- Loads the raw data from Keras.\n",
"- Filters the dataset to only 3s and 6s.\n",
"- Downscales the images so they fit can fit in a quantum computer.\n",
"- Downscales the images so they can fit in a quantum computer.\n",
"- Removes any contradictory examples.\n",
"- Converts the binary images to Cirq circuits.\n",
"- Converts the Cirq circuits to TensorFlow Quantum circuits. "
Expand Down Expand Up @@ -784,7 +784,7 @@
"source": [
"Next, describe the training procedure to the model, using the `compile` method.\n",
"\n",
"Since the the expected readout is in the range `[-1,1]`, optimizing the hinge loss is a somewhat natural fit. \n",
"Since the expected readout is in the range `[-1,1]`, optimizing the hinge loss is a somewhat natural fit. \n",
"\n",
"Note: Another valid approach would be to shift the output range to `[0,1]`, and treat it as the probability the model assigns to class `3`. This could be used with a standard a `tf.losses.BinaryCrossentropy` loss.\n",
"\n",
Expand Down Expand Up @@ -812,7 +812,7 @@
"id": "5nwnveDiojh7"
},
"source": [
"Second, use a custiom `hinge_accuracy` metric that correctly handles `[-1, 1]` as the `y_true` labels argument. \n",
"Second, use a custom `hinge_accuracy` metric that correctly handles `[-1, 1]` as the `y_true` labels argument. \n",
"`tf.losses.BinaryAccuracy(threshold=0.0)` expects `y_true` to be a boolean, and so can't be used with hinge loss)."
]
},
Expand Down Expand Up @@ -926,7 +926,7 @@
"source": [
"qnn_history = model.fit(x_train_tfcirc_sub,\n",
" y_train_hinge_sub,\n",
" batch_size=32,\n",
" batch_size=BATCH_SIZE,\n",
" epochs=EPOCHS,\n",
" verbose=1,\n",
" validation_data=(x_test_tfcirc, y_test_hinge))\n",
Expand Down
Loading