This is the reference implementation for "Coresets via Bilevel Optimization for Continual Learning and Streaming"

Overview

Coresets via Bilevel Optimization

This is the reference implementation for "Coresets via Bilevel Optimization for Continual Learning and Streaming" https://arxiv.org/pdf/2006.03875.pdf.

This repository also contains the implementation of the selection via Nyström proxy used for selecting batches in "Semi-supervised Batch Active Learning via Bilevel Optimization" https://arxiv.org/pdf/2010.09654. Selection via the Nyström proxy supports data augmentation, it is faster for larger coresets and hence supersedes the representer proxy in data summarization scenarios.

Overview

To get started with the library, check out demo.ipynb Open In Colab that shows how to build coresets for a toy regression problem and for MNIST classification. The following snippet outlines the general usage:

import bilevel_coreset
import loss_utils
import numpy as np

x, y = load_data()

# define proxy kernel function
linear_kernel_fn = lambda x1, x2: np.dot(x1, x2.T)

coreset_size = 10

coreset_constructor = bilevel_coreset.BilevelCoreset(outer_loss_fn=loss_utils.cross_entropy,
                                                    inner_loss_fn=loss_utils.cross_entropy,
                                                    out_dim=y.shape[1])
coreset_inds, coreset_weights = coreset_constructor.build_with_representer_proxy_batch(x, y, 
                                                    coreset_size, linear_kernel_fn, inner_reg=1e-3)
x_coreset, y_coreset = x[coreset_inds], y[coreset_inds]

Note: if you are planning to use the library on your problem, the most important hyperparameter to tune is inner_reg, the regularizer of the inner objective in the representer proxy - try the grid [10-2, 10-3, 10-4, 10-5, 10-6].

Requirements

Python 3 is required. To install the required dependencies, run:

pip install -r requirements.txt

If you are planning to use the NTK proxy, consider installing the GPU version of JAX: instructions here. If you would like to run the experiments, add the project root to your PYTHONPATH env variable.

Data Summarization

Change dir to data_summarization. For running and plotting the MNIST summarization experiment, adjust the globals in runner.py to your setup and run:

python runner.py --exp cnn_mnist
python plotter.py --exp cnn_mnist

Similarly, for the CIFAR-10 summary for a version of ResNet-18 run:

python runner.py --exp resnet_cifar
python plotter.py --exp resnet_cifar

For running the Kernel Ridge Regression experiment, you first need to generate the kernel with python generate_cntk.py. Note: this implementation differs in the kernel choice in generate_kernel() from the paper. For details on the original kernel, please refer to the paper. Once you generated the kernel, generate the results by:

python runner.py --exp krr_cifar
python plotter.py --exp krr_cifar 

Continual Learning and Streaming

We showcase the usage our coreset construction in continual learning and streaming with memory replay. The buffer regularizer beta is tuned individually for each method. We provide the best betas from [0.01, 0.1, 1.0, 10.0, 100.0, 1000.0] for each method in cl_results/ and streaming_results/.

Running the Experiments

Change dir to cl_streaming. After this, you can run individual experiments, e.g.:

python cl.py --buffer_size 100 --dataset splitmnist --seed 0 --method coreset --beta 100.0

You can also run the continual learning and streaming experiments with grid search over beta on datasets derived from MNIST by adjusting the globals in runner.py to your setup and running:

python runner.py --exp cl
python runner.py --exp streaming
python runner.py --exp imbalanced_streaming

The table of result can be displayed by running python process_results.py with the corresponding --exp argument. For example, python process_results.py --exp imbalanced_streaming produces:

Method \ Dataset splitmnistimbalanced
reservoir 80.60 +- 4.36
cbrs 89.71 +- 1.31
coreset 92.30 +- 0.23

The experiments derived from CIFAR-10 can be similarly run by:

python cifar_runner.py --exp cl
python process_results --exp splitcifar
python cifar_runner.py --exp imbalanced_streaming
python process_results --exp imbalanced_streaming_cifar

Selection via the Nyström proxy

The Nyström proxy was proposed to support data augmentations. It is also faster for larger coresets than the representer proxy. An example of running the selection on CIFAR-10 can be found in batch_active_learning/nystrom_example.py.

Citation

If you use the code in a publication, please cite the paper:

@article{borsos2020coresets,
      title={Coresets via Bilevel Optimization for Continual Learning and Streaming}, 
      author={Zalán Borsos and Mojmír Mutný and Andreas Krause},
      year={2020},
      journal={arXiv preprint arXiv:2006.03875}
}
Owner
Zalán Borsos
PhD student at ETH Zurich
Zalán Borsos
Repository for the paper titled: "When is BERT Multilingual? Isolating Crucial Ingredients for Cross-lingual Transfer"

When is BERT Multilingual? Isolating Crucial Ingredients for Cross-lingual Transfer This repository contains code for our paper titled "When is BERT M

Princeton Natural Language Processing 9 Dec 23, 2022
《Improving Unsupervised Image Clustering With Robust Learning》(2020)

Improving Unsupervised Image Clustering With Robust Learning This repo is the PyTorch codes for "Improving Unsupervised Image Clustering With Robust L

Sungwon Park 129 Dec 27, 2022
Official Pytorch implementation of 'GOCor: Bringing Globally Optimized Correspondence Volumes into Your Neural Network' (NeurIPS 2020)

Official implementation of GOCor This is the official implementation of our paper : GOCor: Bringing Globally Optimized Correspondence Volumes into You

Prune Truong 71 Nov 18, 2022
Continual World is a benchmark for continual reinforcement learning

Continual World Continual World is a benchmark for continual reinforcement learning. It contains realistic robotic tasks which come from MetaWorld. Th

41 Dec 24, 2022
Ejemplo Algoritmo Viterbi - Example of a Viterbi algorithm applied to a hidden Markov model on DNA sequence

Ejemplo Algoritmo Viterbi Ejemplo de un algoritmo Viterbi aplicado a modelo ocul

Mateo Velásquez Molina 1 Jan 10, 2022
Theano is a Python library that allows you to define, optimize, and evaluate mathematical expressions involving multi-dimensional arrays efficiently. It can use GPUs and perform efficient symbolic differentiation.

============================================================================================================ `MILA will stop developing Theano https:

9.6k Jan 06, 2023
MoveNet Single Pose on OpenVINO

MoveNet Single Pose tracking on OpenVINO Running Google MoveNet Single Pose models on OpenVINO. A convolutional neural network model that runs on RGB

35 Nov 11, 2022
SmartSim Infrastructure Library.

Home Install Documentation Slack Invite Cray Labs SmartSim SmartSim makes it easier to use common Machine Learning (ML) libraries like PyTorch and Ten

Cray Labs 139 Jan 01, 2023
PyTorch implementation of Pointnet2/Pointnet++

Pointnet2/Pointnet++ PyTorch Project Status: Unmaintained. Due to finite time, I have no plans to update this code and I will not be responding to iss

Erik Wijmans 1.2k Dec 29, 2022
Robbing the FED: Directly Obtaining Private Data in Federated Learning with Modified Models

Robbing the FED: Directly Obtaining Private Data in Federated Learning with Modified Models This repo contains a barebones implementation for the atta

16 Dec 04, 2022
A new GCN model for Point Cloud Analyse

Pytorch Implementation of PointNet and PointNet++ This repo is implementation for VA-GCN in pytorch. Classification (ModelNet10/40) Data Preparation D

12 Feb 02, 2022
Exponential Graph is Provably Efficient for Decentralized Deep Training

Exponential Graph is Provably Efficient for Decentralized Deep Training This code repository is for the paper Exponential Graph is Provably Efficient

3 Apr 20, 2022
The implementation of FOLD-R++ algorithm

FOLD-R-PP The implementation of FOLD-R++ algorithm. The target of FOLD-R++ algorithm is to learn an answer set program for a classification task. Inst

13 Dec 23, 2022
HiFi++: a Unified Framework for Neural Vocoding, Bandwidth Extension and Speech Enhancement

HiFi++ : a Unified Framework for Neural Vocoding, Bandwidth Extension and Speech Enhancement This is the unofficial implementation of Vocoder part of

Rishikesh (ऋषिकेश) 118 Dec 29, 2022
A PyTorch implementation of "Cluster-GCN: An Efficient Algorithm for Training Deep and Large Graph Convolutional Networks" (KDD 2019).

ClusterGCN ⠀⠀ A PyTorch implementation of "Cluster-GCN: An Efficient Algorithm for Training Deep and Large Graph Convolutional Networks" (KDD 2019). A

Benedek Rozemberczki 697 Dec 27, 2022
OMLT: Optimization and Machine Learning Toolkit

OMLT is a Python package for representing machine learning models (neural networks and gradient-boosted trees) within the Pyomo optimization environment.

C⚙G - Imperial College London 179 Jan 02, 2023
Keras implementation of the GNM model in paper ’Graph-Based Semi-Supervised Learning with Nonignorable Nonresponses‘

Graph-based joint model with Nonignorable Missingness (GNM) This is a Keras implementation of the GNM model in paper ’Graph-Based Semi-Supervised Lear

Fan Zhou 2 Apr 17, 2022
Learned image compression

Overview Pytorch code of our recent work A Unified End-to-End Framework for Efficient Deep Image Compression. We first release the code for Variationa

Jiaheng Liu 163 Dec 04, 2022
The official implementation of our CVPR 2021 paper - Hybrid Rotation Averaging: A Fast and Robust Rotation Averaging Approach

Graph Optimizer This repo contains the official implementation of our CVPR 2021 paper - Hybrid Rotation Averaging: A Fast and Robust Rotation Averagin

Chenyu 109 Dec 23, 2022
Code for "On the Effects of Batch and Weight Normalization in Generative Adversarial Networks"

Note: this repo has been discontinued, please check code for newer version of the paper here Weight Normalized GAN Code for the paper "On the Effects

Sitao Xiang 182 Sep 06, 2021