Code to replicate the experimental results from A differentiable rank-based objective for better feature learning.
To set up a working environment for this repository, you can create a conda environment using the following commands:
conda env create -f environment.yaml
conda activate diffociIf conda is not available, please install the dependencies listed in the requirements.txt file.
The code for reproducing the experiments and obtaining the numbers in Tables 1-4 can be found in the corresponding ipynb notebooks:
- Table_1.ipynb -> Synthetic and Toy experiments
- Table_2.ipynb -> Feature selection and Dimensionality Reduction
- Table_3.ipynb -> Spurious correlations and Domain Adaptation
- Table_4.ipynb -> Fairness
This script downloads, extracts and formats the datasets metadata so that it works with the rest of the code out of the box.
python setup_datasets.py --download --data_path dataTo reproduce the Waterbirds experiments on a SLURM cluster :
python train.py --data_path data --output_dir main_sweep --partition <slurm_partition>This source code is released under the CC-BY license, included here.