Skip to main content

Classification with Born's rule

Project description

Classification with Born's Rule

This repository implements the classifier proposed in:

Emanuele Guidotti and Alfio Ferrara. Text Classification with Born’s Rule. Advances in Neural Information Processing Systems, 2022.

[Paper] - [Slides] - [Poster]


pip install bornrule



from bornrule import BornClassifier
  • Use it as any other sklearn classifier
  • Supports both dense and sparse input and GPU-accelerated computing via cupy
  • Documentation available here


from bornrule.torch import Born
  • Use it as any other torch layer
  • Supports real and complex-valued inputs. Outputs probabilities in the range [0, 1]
  • Documentation available here


from bornrule.sql import BornClassifierSQL
  • Use it for in-database classification
  • Supports inputs represented as json {feature: value, ...}
  • Documentation available here

Paper replication

All the results in the paper are obtained using Python 3.9 on a Google Cloud Virtual Machine equipped with CentOS 7, 12 vCPU Intel Cascade Lake 85 GB RAM, 1 GPU NVIDIA Tesla A100, and CUDA 11.5.

Install this package:

pip install bornrule==0.1.0

Install additional dependencies to replicate the paper:

pip install bs4==0.0.1 nltk==3.7 matplotlib==3.5.1

Install pytorch version 1.11.0 with GPU support. For CUDA 11.5 the command is:

pip install torch==1.11.0+cu115 -f

Install cupy version 10.4.0. For CUDA 11.5 the command is:

pip install cupy-cuda115==10.4.0

Run the script

python -u > nips.log &

The script generates a folder named results with all the results in the paper. Additional information are saved to the log file nips.log

Cite as

Please cite the following when using this software:

  title={Text Classification with Born's Rule},
  author={Emanuele Guidotti and Alfio Ferrara},
  booktitle={Advances in Neural Information Processing Systems},
  editor={Alice H. Oh and Alekh Agarwal and Danielle Belgrave and Kyunghyun Cho},

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bornrule-0.1.0.tar.gz (27.1 kB view hashes)

Uploaded source

Built Distribution

bornrule-0.1.0-py3-none-any.whl (28.2 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page