Skip to content

Commit c97e896

Browse files
authored
[Doc] Reorganizing doc, linking to tutorials (#84)
1 parent 6d71303 commit c97e896

File tree

7 files changed

+85
-75
lines changed

7 files changed

+85
-75
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ Pipfile
4646
runs/
4747
*venv
4848
*~
49+
dataset/
4950

5051
# Mkdocs
5152
site/

docs/index.md

Lines changed: 4 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,12 @@
11
# "Quantum Evolution Kernel"
2-
## Installation
3-
### Using `hatch`, `uv` or any pyproject-compatible Python manager
42

5-
Edit file `pyproject.toml` to add the line
63

7-
```toml
8-
"quantum-evolution-kernel"
9-
```
4+
The Quantum Evolution Kernel is a Python library designed for the machine learning community to help users design quantum-driven similarity metrics for graphs and to use them inside kernel-based machine learning algorithms for graph data.
105

11-
to the list of `dependencies`.
6+
The core of the library is focused on the development of a classification algorithm for molecular-graph dataset as it is presented in the published paper [Quantum feature maps for graph machine learning on a neutral atom quantum processor](https://journals.aps.org/pra/abstract/10.1103/PhysRevA.107.042615).
127

13-
### Using `pip` or `pipx`
14-
To install the `pipy` package using `pip` or `pipx`
8+
Users setting their first steps into quantum computing will learn how to implement the core algorithm in a few simple steps and run it using the Pasqal Neutral Atom QPU. More experienced users will find this library to provide the right environment to explore new ideas - both in terms of methodologies and data domain - while always interacting with a simple and intuitive QPU interface.
159

16-
1. Create a `venv` if that's not done yet
17-
18-
```sh
19-
$ python -m venv venv
20-
21-
```
22-
23-
2. Enter the venv
24-
25-
```sh
26-
$ . venv/bin/activate
27-
```
28-
29-
3. Install the package
30-
31-
```sh
32-
$ pip install quantum-evolution-kernel
33-
# or
34-
$ pipx install quantum-evolution-kernel
35-
```
36-
37-
## Usage
38-
39-
```python
40-
# Load a dataset
41-
import torch_geometric.datasets as pyg_dataset
42-
og_ptcfm = pyg_dataset.TUDataset(root="dataset", name="PTC_FM")
43-
44-
# Setup a quantum feature extractor for this dataset.
45-
# In this example, we'll use QutipExtractor, to emulate a Quantum Device on our machine.
46-
import qek.data.graphs as qek_graphs
47-
import qek.data.extractors as qek_extractors
48-
extractor = qek_extractors.QutipExtractor(compiler=qek_graphs.PTCFMCompiler())
49-
50-
# Add the graphs, compile them and look at the results.
51-
extractor.add_graphs(graphs=og_ptcfm)
52-
extractor.compile()
53-
processed_dataset = extractor.run().processed_data
54-
55-
# Prepare a machine learning pipeline with Scikit Learn.
56-
from sklearn.model_selection import train_test_split
57-
from sklearn.svm import SVC
58-
59-
X = [data for data in processed_dataset] # Features
60-
y = [data.target for data in processed_dataset] # Targets
61-
X_train, X_test, y_train, y_test = train_test_split(X, y, stratify = y, test_size=0.2, random_state=42)
62-
63-
# Train a kernel
64-
from qek.kernel import QuantumEvolutionKernel as QEK
65-
kernel = QEK(mu=0.5)
66-
model = SVC(kernel=kernel, random_state=42)
67-
model.fit(X_train, y_train)
68-
```
69-
70-
## Documentation
71-
72-
::: qek
73-
74-
## Tutorials
75-
76-
We have a two parts tutorial:
77-
78-
1. [Using a Quantum Device to extract machine-learning features](https://github.com/pasqal-io/quantum-evolution-kernel/blob/main/examples/tutorial%201%20-%20Using%20a%20Quantum%20Device%20to%20Extract%20Machine-Learning%20Features.ipynb);
79-
2. [Machine Learning with the Quantum Evolution Kernel](https://github.com/pasqal-io/quantum-evolution-kernel/blob/main/examples/tutorial%202%20-%20Machine-Learning%20with%20the%20Quantum%20EvolutionKernel.ipynb)
8010

8111
## Getting in touch
8212

@@ -88,4 +18,4 @@ We have a two parts tutorial:
8818

8919
The GitHub repository is open for contributions!
9020

91-
Don't forget to read the [Contributor License Agreement]().
21+
Don't forget to read the [Contributor License Agreement](https://github.com/pasqal-io/quantum-evolution-kernel/blob/main/docs/index.md).

docs/installation.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Installation
2+
## Using `hatch`, `uv` or any pyproject-compatible Python manager
3+
4+
Edit file `pyproject.toml` to add the line
5+
6+
```toml
7+
"quantum-evolution-kernel"
8+
```
9+
10+
to the list of `dependencies`.
11+
12+
## Using `pip` or `pipx`
13+
To install the `pipy` package using `pip` or `pipx`
14+
15+
1. Create a `venv` if that's not done yet
16+
17+
```sh
18+
$ python -m venv venv
19+
20+
```
21+
22+
2. Enter the venv
23+
24+
```sh
25+
$ . venv/bin/activate
26+
```
27+
28+
3. Install the package
29+
30+
```sh
31+
$ pip install quantum-evolution-kernel
32+
# or
33+
$ pipx install quantum-evolution-kernel
34+
```

docs/tutorials.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Quantum Extraction
2+
3+
These tutorials will teach you how to use the quantum APIs for feature-extraction:
4+
5+
1. [Using a Quantum Device to extract machine-learning features (high-level)](https://github.com/pasqal-io/quantum-evolution-kernel/blob/main/examples/tutorial%201%20-%20Using%20a%20Quantum%20Device%20to%20Extract%20Machine-Learning%20Features.ipynb);
6+
2. [Using a Quantum Device to extract machine-learning features (low-level)](https://github.com/pasqal-io/quantum-evolution-kernel/blob/main/examples/tutorial%201a%20-%20Using%20a%20Quantum%20Device%20to%20Extract%20Machine-Learning%20Features%20-%20low-level.ipynb);
7+
8+
# Machine Learning
9+
10+
1. [Machine Learning with the Quantum Evolution Kernel](https://github.com/pasqal-io/quantum-evolution-kernel/blob/main/examples/tutorial%202%20-%20Machine-Learning%20with%20the%20Quantum%20EvolutionKernel.ipynb)

docs/usage.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Usage
2+
3+
```python
4+
# Load a dataset
5+
import torch_geometric.datasets as pyg_dataset
6+
og_ptcfm = pyg_dataset.TUDataset(root="dataset", name="PTC_FM")
7+
8+
# Setup a quantum feature extractor for this dataset.
9+
# In this example, we'll use QutipExtractor, to emulate a Quantum Device on our machine.
10+
import qek.data.graphs as qek_graphs
11+
import qek.data.extractors as qek_extractors
12+
extractor = qek_extractors.QutipExtractor(compiler=qek_graphs.PTCFMCompiler())
13+
14+
# Add the graphs, compile them and look at the results.
15+
extractor.add_graphs(graphs=og_ptcfm)
16+
extractor.compile()
17+
processed_dataset = extractor.run().processed_data
18+
19+
# Prepare a machine learning pipeline with Scikit Learn.
20+
from sklearn.model_selection import train_test_split
21+
from sklearn.svm import SVC
22+
23+
X = [data for data in processed_dataset] # Features
24+
y = [data.target for data in processed_dataset] # Targets
25+
X_train, X_test, y_train, y_test = train_test_split(X, y, stratify = y, test_size=0.2, random_state=42)
26+
27+
# Train a kernel
28+
from qek.kernel import QuantumEvolutionKernel as QEK
29+
kernel = QEK(mu=0.5)
30+
model = SVC(kernel=kernel, random_state=42)
31+
model.fit(X_train, y_train)
32+
```

mkdocs.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ repo_name: "Quantum Evolution Kernel"
44

55
nav:
66
- Overview: index.md
7+
- Installation: installation.md
8+
- Usage: usage.md
9+
- Tutorials: tutorials.md
710
- Reference: $api/qek.***
811
- License: LICENSE.md
912
- CLA: CONTRIBUTOR AGREEMENT.md

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ build-backend = "hatchling.build"
66
name = "quantum-evolution-kernel"
77
description = "A Python library designed for the machine learning community to help users design quantum-driven similarity metrics for graphs and to use them inside kernel-based machine learning algorithms for graph data.ide the right environment to explore new ideas - both in terms of methodologies and data domain - while always interacting with a simple and intuitive QPU interface."
88
readme = "README.md"
9-
version = "0.2.7"
9+
version = "0.2.8"
1010
requires-python = ">=3.10,<3.13"
1111
license = { text = "MIT-derived" }
1212
keywords = ["quantum"]

0 commit comments

Comments
 (0)