This Python package implements quantum decision tree classifiers for binary data. The details of the method can be found in Representation of binary classification trees with binary features by quantum circuits.
Installation
Install via pip
or clone this repository. In order to use pip
, type:
$ pip install quantum-tree
The package is tested with Python 3.8 and Python 3.9.
🌳 Usage
Minimal working example:
# create quantum tree instance
from qtree.qtree import QTree
qtree = QTree(max_depth=1)
# create simple training data
import numpy as np
X = np.array([[1,0,0], [0,1,0], [0,0,1]]) # features
y = np.array([[0,0], [0,1], [1,1]]) # labels
# fit quantum tree
qtree.fit(X, y)
# make quantum tree prediction
qtree.predict([[0,0,1]])
Documentation
Documentation is available on https://qtree.readthedocs.io/en/latest.
Demo notebooks can be found in the examples/
directory.
📖 Citation
If you find this code useful in your research, please consider citing Representation of binary classification trees with binary features by quantum circuits:
@article{Heese2022representationof,
doi = {10.22331/q-2022-03-30-676},
url = {https://doi.org/10.22331/q-2022-03-30-676},
title = {Representation of binary classification trees with binary features by quantum circuits},
author = {Heese, Raoul and Bickert, Patricia and Niederle, Astrid Elisa},
journal = {{Quantum}},
issn = {2521-327X},
publisher = {{Verein zur F{\"{o}}rderung des Open Access Publizierens in den Quantenwissenschaften}},
volume = {6},
pages = {676},
month = {3},
year = {2022}
}
This project is currently not under development and is not actively maintained.