https://github.com/andreasgrv/sigmoid-bottleneck
Sparse Multi Label Classification
https://github.com/andreasgrv/sigmoid-bottleneck
Last synced: 11 months ago
JSON representation
Sparse Multi Label Classification
- Host: GitHub
- URL: https://github.com/andreasgrv/sigmoid-bottleneck
- Owner: andreasgrv
- License: mit
- Created: 2023-10-02T10:07:16.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-10-17T13:28:12.000Z (over 2 years ago)
- Last Synced: 2024-05-02T02:35:34.188Z (about 2 years ago)
- Language: Python
- Size: 545 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Sparse Multi-Label Classification (spmlbl)
Herein we provide the code to reproduce our results for the paper:
[Taming the Sigmoid Bottleneck: Provably Argmaxable Sparse Multi-Label Classification](https://arxiv.org/abs/2310.10443)
# Installation
Below installation is for main library.
## Install Python Dependencies
```bash
python3.8 -m venv .env
source .env/bin/activate
# Adapt cuda in requirements to your use case
pip install -r requirements.txt
pip install -e .
# NOTE: For each specific dataset you may need to install more libraries
# See README.md file in each experiment section
```
## Set Environment Variables
```bash
# Avoid pytorch using too many threads
export OMP_NUM_THREADS=1
export MKL_NUM_THREADS=1
# Random seed - needed for exps
export SEED=0
# What device to run models on
export MLBL_DEVICE="cuda:0"
# Number of threads
export MLBL_NUM_PROC=10
```
## Install [Gurobi](https://www.gurobi.com/academia/academic-program-and-licenses/)
The linear programming algorithm that detects (un)argmaxable label assignments depends on Gurobi.
It requires a license, see link above.
## Run Tests
Tests require dependencies and Gurobi.
```bash
py.test tests
```
## Experiments
For each dataset, see the `README.md` file in the corresponding folder under experiments.
* [MIMIC-III](experiments/mimic/README.md)
* [BioASQ Task A](experiments/bioasq/README.md)
* [OpenImages v6](experiments/openimagesv6/README.md)