Skip to content

Commit b517983

Browse files
authored
[Doc] Let's not lose track that our tutorial is about predicting toxicity - resolves #88 (#99)
1 parent 36aa3b9 commit b517983

2 files changed

Lines changed: 23 additions & 6 deletions

examples/tutorial 1 - Using a Quantum Device to Extract Machine-Learning Features.ipynb

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"source": [
77
"# Tutorial 1: using a Quantum Device to extract machine-learning features\n",
88
"\n",
9-
"This notebook reproduces the first part of the [QEK paper](https://journals.aps.org/pra/abstract/10.1103/PhysRevA.107.042615) using the library's high-level API, dedicated to features extraction using a Quantum Device.\n",
9+
"The companion library is a machine-learning tool that uses a quantum device to predict similarities and properties of graphs. In this tutorial, we will reproduce first part of the [QEK paper](https://journals.aps.org/pra/abstract/10.1103/PhysRevA.107.042615) using the library's high-level API. The high-level goal of this tutorial is to predict toxicity properties of molecules, using quantum machine learning, but of course, the mechanisms involved are much more generic.\n",
1010
"\n",
1111
"By the end of this notebook, you will know how to:\n",
1212
"\n",
@@ -25,7 +25,7 @@
2525
"source": [
2626
"## Dataset preparation\n",
2727
"\n",
28-
"As in any machine learning task, we first need to load and prepare data. QEK can work with many types of graphs, including molecular graphs. For this tutorial, we will use the PTC-FM dataset, which contains such molecular graphs."
28+
"As in any machine learning task, we first need to load and prepare data. QEK can work with many types of graphs, including molecular graphs. For this tutorial, we will use the PTC-FM dataset, which contains such molecular graphs, labeled with their toxicity."
2929
]
3030
},
3131
{
@@ -87,12 +87,13 @@
8787
"metadata": {},
8888
"outputs": [],
8989
"source": [
90+
"from pathlib import Path\n",
9091
"import qek.data.extractors as qek_extractors\n",
9192
"\n",
9293
"# Use the Qutip Extractor.\n",
9394
"extractor = qek_extractors.QutipExtractor(\n",
9495
" # Once computing is complete, data will be saved in this file.\n",
95-
" path=\"saved_data.json\",\n",
96+
" path=Path(\"saved_data.json\"),\n",
9697
" compiler=compiler\n",
9798
")\n",
9899
"\n",
@@ -309,6 +310,15 @@
309310
"dataset_example.draw_excitation()"
310311
]
311312
},
313+
{
314+
"cell_type": "markdown",
315+
"metadata": {},
316+
"source": [
317+
"Is this distribution of excitation connected to the toxicity of the molecule? To check this out, we'll need to perform some machine-learning engineering.\n",
318+
"\n",
319+
"**Note** Of course, you could derive features completely unrelated to distribution of excitation."
320+
]
321+
},
312322
{
313323
"cell_type": "markdown",
314324
"metadata": {},
@@ -317,8 +327,13 @@
317327
"\n",
318328
"What we have seen so far covers the use of a Quantum Device to extract machine-learning features.\n",
319329
"\n",
320-
"For the next step, we'll see [how to use these features for machine learning](./tutorial%202%20-%20Machine-Learning%20with%20the%20Quantum%20EvolutionKernel.ipynb)."
330+
"For the next step, we'll see [how to use these features for actual machine learning](./tutorial%202%20-%20Machine-Learning%20with%20the%20Quantum%20EvolutionKernel.ipynb)."
321331
]
332+
},
333+
{
334+
"cell_type": "markdown",
335+
"metadata": {},
336+
"source": []
322337
}
323338
],
324339
"metadata": {

examples/tutorial 2 - Machine-Learning with the Quantum EvolutionKernel.ipynb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@
1515
"source": [
1616
"\n",
1717
"### Introduction\n",
18+
"\n",
1819
"Machine Learning (ML) is a field of artificial intelligence that focuses on building systems capable of learning from data to make predictions or decisions. A common ML task is classification, where we try to assign labels to data points. In this tutorial, we will use the **Quantum Evolution Kernel**, a custom kernel that computes the similarity between graph-structured data to model a classification problem using Support Vector Machine (SVM) on graph dataset.\n",
1920
"\n",
21+
"### Tutorial Objectives\n",
2022
"\n",
23+
"In the previous part of this tutorial, we have loaded a dataset of molecules, labelled with their toxicity, and used a quantum device to extract machine-learning features. Now, our high-level objective is to use these features to predict the toxicity of molecules.\n",
2124
"\n",
22-
"### Tutorial Objectives\n",
2325
"This tutorial will guide you through:\n",
2426
"1. Loading and preprocessing a dataset for kernel-based machine learning.\n",
2527
"2. Introduction to **Quantum Evolution Kernel** (QEK), including *fit* and *transform* methods.\n",
@@ -48,7 +50,7 @@
4850
"id": "05e294f5",
4951
"metadata": {},
5052
"source": [
51-
"We begin by loading a dataset that contains graph-structured data. Each data point is represented as a processed object with features and a target value. We will split the data into training and testing sets for model evaluation.\n",
53+
"We begin by loading a dataset that contains graph-structured data. Each data point is represented as a processed object with features (in this example, the quantum distribution excitation for a molecule) and a target value (in this example, the toxicity of the molecule). We will split the data into training and testing sets for model evaluation.\n",
5254
"\n",
5355
"- Each processed data point has a _state_dict_: This dictionary represents an approximation of the quantum state of the device for this graph after completion of the algorithm. From the state dictionary, we derive as machine-learning feature the _distribution of excitation_. We'll use these in the next step to define our kernel.\n",
5456
" "

0 commit comments

Comments
 (0)