Skip to main content

Build Status Build status CircleCI Documentation Status codecov PyPi Status Downloads

Helstrom Quantum Centroid Classifier

The Helstrom Quantum Centroid (HQC) classifier is a quantum-inspired supervised classification approach for data with binary classes (ie. data with 2 classes only). By quantum-inspired, we mean a classification process which employs and exploits Quantum Theory.

It is inspired by the quantum Helstrom observable which acts on the distinguishability between quantum patterns rather than classical patterns of a dataset.

The HQC classifier is based on research undertaken by Giuseppe Sergioli, Roberto Giuntini and Hector Freytes, in their paper:

Sergioli G, Giuntini R, Freytes H (2019) A new quantum approach to binary classification. PLoS ONE 14(5): e0216224.
https://doi.org/10.1371/journal.pone.0216224

This Python package includes the option to vary four hyperparameters which are used to optimize the performance of the HQC classifier:

  • There is an option to rescale the dataset.
  • There are two options to choose how the classical dataset is encoded into quantum densities: inverse of the standard stereographic projection or amplitude encoding method.
  • There is an option to choose the number of copies to take for the quantum densities.
  • There are two options to assign class weights to the quantum Helstrom observable terms: equiprobable or weighted.

These hyperparameters are used in combination together to hypertune and optimize the accuracy of the HQC classifier to a given dataset.

The package also includes an option for parallel computing using Joblib and an option to split datasets into subsets or batches for optimal speed performance. Parallelization is performed over the two classes and subset splits or batches.

It is shown in the paper by Sergioli G, Giuntini R and Freytes H that the HQC classifier, on average, outperforms a variety of commonly used classifiers over 14 real-world and artificial datasets, in particular when the hyperparameter, number of copies, is increased. A summary of the performances of the different classifiers examined are shown in the table below:

Rank Classifier Average Success Rate (%)
1 HelstromQuantumCentroid4 72.80
2 HelstromQuantumCentroid3 65.13
3 GaussianNB 58.00
4 HelstromQuantumCentroid2 57.07
5 HelstromQuantumCentroid1 56.60
5 QuadraticDiscriminantAnalysis 56.60
6 GradientBoostingClassifier 52.73
7 ExtraTreesClassifier 51.93
8 KNeighborsClassifier 51.47
9 NearestCentroid 49.13
10 RandomForestClassifier 45.87
11 QuantumNearestMeanCentroid 43.93
12 AdaBoostClassifier 42.93
13 LinearDiscriminantAnalysis 42.00
14 LogisticRegression 36.40
15 BernoulliNB 17.40

*Average success rate is the average number of datasets where the specified classifier outperforms the other classifiers over 14 real-world and artificial datasets. HelstromQuantumCentroidn is the HQC classifier corresponding to the n number of copies taken for the quantum densities.

The HQC classifier is a true probabilistic classifier, ie. a classifier which gives the class membership probability estimates for each sample without having to use any scaling methods. This means that the probability estimates (from predict_proba) are consistent with the scores (from predict).

Source Code

The Python package's source code for the HQC classifier is available here: https://github.com/leockl/helstrom-quantum-centroid-classifier/blob/master/hqc/hqc.py

Documentation

The documentation, including how to install the Python package, how to use the Python package and how the HQC classifier algorithm works, are available here: https://helstrom-quantum-centroid-classifier.readthedocs.io/en/latest/

License

This Python package is licensed under the BSD 3-Clause License, available here: https://github.com/leockl/helstrom-quantum-centroid-classifier/blob/master/LICENSE

References

Sergioli G, Giuntini R, Freytes H (2019) A new quantum approach to binary classification. PLoS ONE 14(5): e0216224. https://doi.org/10.1371/journal.pone.0216224

Metadata

Release files for hqc 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hqc 0.1.4
File Size Uploaded Provenance Actions
hqc-0.1.4.tar.gz 10.4 kB Without provenance Details for hqc-0.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hqc 0.1.4
File Interpreter ABI Platform Actions
hqc-0.1.4-py3-none-any.whl Python 3 none any Details for hqc-0.1.4-py3-none-any.whl

Total release size: 20.9 kB

Release files / hqc-0.1.4.tar.gz

Download URL hqc-0.1.4.tar.gz
Size 10.4 kB
Tags Source
SHA-256 checksum
How to use checksums
ef03310a497196f5d085833205cebd74c0f820aa1cfd5935add1964245395a23
BLAKE2b-256 checksum
How to use checksums
ab9609c62515143307c5c58dc63adadd8925f6187d7bc629e7e8b6e60e40ef13
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/50.0.3 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.1

Release files / hqc-0.1.4-py3-none-any.whl

Download URL hqc-0.1.4-py3-none-any.whl
Size 10.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
41e6008c68a8922ac6cb44073eb09b51fce2c1c8e4714cc345016933b5f4965a
BLAKE2b-256 checksum
How to use checksums
adbb2c5b81f5ad2d150e6f2a9d365b99e1600e91e4a88403bef37e136adbdf99
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/50.0.3 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.1

Security for hqc 0.1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page