Skip to content

GarrettJenkinson/condor_pytorch

Repository files navigation

CONDOR pytorch implementation for ordinal regression with deep neural networks.

Continuous Integration License Python 3


Documentation: https://GarrettJenkinson.github.io/condor_pytorch


About

CONDOR, short for CONDitionals for Ordinal Regression, is a method for ordinal regression with deep neural networks, which addresses the rank inconsistency issue of other ordinal regression frameworks.

It is compatible with any state-of-the-art deep neural network architecture, requiring only modification of the output layer, the labels, the loss function.

This repository implements the CONDOR functionality (neural network layer, loss function, and dataset utilities) for convenient use. Examples are provided via the "Tutorials" that can be found on the documentation website at https://GarrettJenkinson.github.io/condor_pytorch.

We also have CONDOR implemented for Tensorflow.


Installation or Docker


You can install the latest stable release of condor_pytorch directly from Python's package index via pip by executing the following code from your command line:

pip install condor-pytorch

The dependencies can also be pip installed also using the included requirements.txt:

pip install -r requirements.txt

We also provide Dockerfile's to help get up and started quickly with condor_pytorch. The cpu image can be built and ran as follows, with tutorial jupyter notebooks built in.

# Create a docker image, only done once
docker build -t cpu_pytorch -f cpu.Dockerfile ./

# run image to serve a jupyter notebook
docker run -it -p 8888:8888 --rm cpu_pytorch

# how to run bash inside container (with python that will have deps)
docker run -u $(id -u):$(id -g) -it -p 8888:8888 --rm cpu_pytorch bash

An NVIDIA based gpu optimized container can be built and run as follows (without interactive ipynb capabilities).

# only needs to be built once
docker build -t gpu_pytorch -f gpu.Dockerfile ./

# use the image after building it
docker run -it -p 8888:8888 --rm gpu_pytorch

Cite as

If you use CONDOR as part of your workflow in a scientific publication, please consider citing the CONDOR repository with the following DOI:

@article{condor2021,
title = "Universally rank consistent ordinal regression in neural networks",
journal = "arXiv",
volume = "2110.07470",
year = "2021",
url = "https://arxiv.org/abs/2110.07470",
author = "Garrett Jenkinson and Kia Khezeli and Gavin R. Oliver and John Kalantari and Eric W. Klee",
keywords = "Deep learning, Ordinal regression, neural networks, Machine learning, Biometrics"
}

Acknowledgments: Many thanks to the CORAL ordinal authors and the CORAL pytorch authors whose repos provided a roadmap for this codebase.