Giter Site home page Giter Site logo

eguidotti / bornrule Goto Github PK

View Code? Open in Web Editor NEW
7.0 4.0 0.0 5.78 MB

Code for the paper "Text Classification with Born's Rule", Advances in Neural Information Processing Systems, 2022.

Home Page: https://proceedings.neurips.cc/paper_files/paper/2022/hash/c88d0c9bea6230b518ce71268c8e49e0-Abstract-Conference.html

License: GNU General Public License v3.0

Python 100.00%
classification deep-learning machine-learning

bornrule's Introduction

Classification with Born's Rule

This repository contains the code for the paper Text Classification with Born's Rule. The classifier is implemented in python and available on PyPI. The documentation is available here.

Installation

Install via pip with:

pip install bornrule

Usage

The package implements three versions of the classifier. The classification algorithm is compatible with the scikit-learn ecosystem. The neural version is compatible with pytorch. The SQL version supports in-database classification.

Scikit-Learn

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

PyTorch

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]

SQL

from bornrule.sql import BornClassifierSQL
  • Equivalent to the class BornClassifier but for in-database classification
  • Supports inputs represented as json {feature: value, ...}

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 https://download.pytorch.org/whl/torch_stable.html

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

pip install cupy-cuda115==10.4.0

Run the script nips.py:

python -u nips.py > 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

Emanuele Guidotti and Alfio Ferrara. Text Classification with Born's Rule. In Advances in Neural Information Processing Systems, volume 35, pages 30990–31001, 2022.

A BibTeX entry for LaTeX users is:

@inproceedings{guidotti2022text,
 title = {Text Classification with Born's Rule},
 author = {Guidotti, Emanuele and Ferrara, Alfio},
 booktitle = {Advances in Neural Information Processing Systems},
 pages = {30990--31001}, 
 volume = {35},
 year = {2022}
}

bornrule's People

Stargazers

 avatar Marcelo Sant'Anna avatar Jonathan Völkle avatar Francesco Cazzaro avatar Seyda Eroğlu avatar Gökçe Uludoğan avatar Lorenzo Imbonati avatar

Watchers

Marcelo Sant'Anna avatar Alfio Ferrara avatar Kostas Georgiou avatar Emanuele Guidotti avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.