google-deepmind/covariate_shifted_llp

Python

Open original ↗

Captured source

source ↗

google-deepmind/covariate_shifted_llp

Description: Code accompanying UAI'25 paper titled "Learning from Label Proportions and Covariate-shifted Instances"

Language: Python

License: Apache-2.0

Stars: 2

Forks: 1

Open issues: 0

Created: 2025-06-12T09:08:09Z

Pushed: 2025-06-12T09:18:13Z

Default branch: main

Fork: no

Archived: no

README:

Covariate Shifted LLP

This is the code accompanying UAI'25 paper titled "Learning from Label Proportions and Covariate-shifted Instances". Specifically, the following are included in this project:

1. Implementation of proposed algorithms and baselines. 2. Scripts to preprocess datasets. 3. Training and evaluation code that dumps the results.

Installation

It is advised to run all the commands from the parent directory of the project. To setup the environment and installing dependencies:

# option 1: use conda environment
conda create -n covariate_shifted_llp python=3.12
conda activate covariate_shifted_llp

# option 2: use venv
python --version # make sure you have python 3.12
python -m venv covariate_shifted_llp/.venv
source covariate_shifted_llp/.venv

# install dependencies
pip install -r covariate_shifted_llp/requirements.txt

Usage

It is advised to run all the commands from the parent directory of the project.

Preprocess Datasets

Wine Dataset

1. Download the raw data from this url and unzip. 2. Verify that you have two files train.csv and test.csv in covariate_shifted_llp/src/config/data/Wine_Data. 3. To preprocess, run the following:

export PYTHONPATH=$PWD:$PYTHONPATH
python covariate_shifted_llp/src/config/data/preprocess_wine.py

IPUMS Dataset

1. Download the raw data from this url for the years 1970 and 2022. 2. Verify that you have a file usa-00001.csv in covariate_shifted_llp/src/config/data/USC_Standardized_Data. 3. To preprocess, run the following:

export PYTHONPATH=$PWD:$PYTHONPATH
python covariate_shifted_llp/src/config/data/preprocess_ipums.py

Criteo SSCL Dataset

1. Download the raw data from this url and unzip. 2. Verify that you have the file CriteoSearchData in covariate_shifted_llp/src/config/data/CriteoSCCL_Modified. 3. To preprocess, run the following:

export PYTHONPATH=$PWD:$PYTHONPATH
python covariate_shifted_llp/src/config/data/preprocess_criteo.py

Running training and evaluations

To view and understand all the launch arguments, run the following:

export PYTHONPATH=$PWD:$PYTHONPATH
python covariate_shifted_llp/launch/launch.py --help

An example command to launch an experiment is as follows:

export PYTHONPATH=$PWD:$PYTHONPATH
python covariate_shifted_llp/launch/launch.py \
--experiment_dir=/path/to/save/results/and/checkpoints \
--dataset=synth \
--bag_config=same_8 \
--sample_size=4096 \
--train_batch_size=1 \
--test_batch_size=4096 \
--same_sample_size=true \
--is_correlated=false \
--mean_perturbation=1 \
--std_perturbation=0 \
--model=blwfa \
--lambda_domain=1e-5 \
--lambda_parameter=1e-4 \
--lambda_dllp_source=1 \
--lambda_dllp_target=1 \
--optimizer=adam \
--learning_rate=1e-5 \
--weight_decay=0 \
--epochs=16000

Running this will dump the model checkpoints, logs and scores in the launch/results directory.

Citing this work

@article{singh2024learninglabelproportionscovariateshifted,
title={Learning from Label Proportions and Covariate-shifted Instances},
author={Sagalpreet Singh and Navodita Sharma and Shreyas Havaldar and Rishi Saket and Aravindan Raghuveer},
year={2025},
}

License and disclaimer

Copyright 2025 Google LLC

All software is licensed under the Apache License, Version 2.0 (Apache 2.0); you may not use this file except in compliance with the Apache 2.0 license. You may obtain a copy of the Apache 2.0 license at: https://www.apache.org/licenses/LICENSE-2.0

All other materials are licensed under the Creative Commons Attribution 4.0 International License (CC-BY). You may obtain a copy of the CC-BY license at: https://creativecommons.org/licenses/by/4.0/legalcode

Unless required by applicable law or agreed to in writing, all software and materials distributed here under the Apache 2.0 or CC-BY licenses are distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the licenses for the specific language governing permissions and limitations under those licenses.

This is not an official Google product.

Notability

notability 1.0/10

Low-star new repo from DeepMind