Active and Sample-Efficient Model Evaluation

Overview

Active Testing: Sample-Efficient Model Evaluation

Hi, good to see you here! 👋

This is code for "Active Testing: Sample-Efficient Model Evaluation".

Please cite our paper, if you find this helpful:

@article{kossen2021active,
  title={{A}ctive {T}esting: {S}ample-{E}fficient {M}odel {E}valuation},
  author={Kossen, Jannik and Farquhar, Sebastian and Gal, Yarin and Rainforth, Tom},
  journal={arXiv:2103.05331},
  year={2021}
}

animation

Setup

The requirements.txt can be used to set up a python environment for this codebase. You can do this, for example, with conda:

conda create -n isactive python=3.8
conda activate isactive
pip install -r requirements.txt

Reproducing the Experiments

  • To reproduce a figure of the paper, first run the appropriate experiments
sh reproduce/experiments/figure-X.sh
  • And then create the plots with the Jupyter Notebook at
notebooks/plots_paper.ipynb
  • (The notebook let's you conveniently select which plots to recreate.)

  • Which should put plots into notebooks/plots/.

  • In the above, replace X by

    • 123 for Figures 1, 2, 3
    • 4 for Figure 4
    • 5 for Figure 5
    • 6 for Figure 6
    • 7 for Figure 7
  • Other notes

    • Synthetic data experiments do not require GPUs and should run on pretty much all recent hardware.
    • All other plots, realistically speaking, require GPUs.
    • We are also happy to share a 4 GB file with results from all experiments presented in the paper.
    • You may want to produce plots 7 and 8 for other experiment setups than the one in the paper, i.e. ones you already have computed.
    • Some experiments, e.g. those for Figures 4 or 6, may run a really long time on a single GPU. It may be good to
      • execute the scripts in the sh-files in parallel on multiple GPUs.
      • start multiple runs in parallel and then combine experiments. (See below).
      • end the runs early / decrease number of total runs (this can be very reasonable -- look at the config files in conf/paper to modify this property)
    • If you want to understand the code, below we give a good strategy for approaching it. (Also start with synthetic data experiments. They have less complex code!)

Running A Custom Experiment

  • main.py is the main entry point into this code-base.

    • It executes a a total of n_runs active testing experiments for a fixed setup.
    • Each experiment:
      • Trains (or loads) one main model.
      • This model can then be evaluated with a variety of acquisition strategies.
      • Risk estimates are then computed for points/weights from all acquisition strategies for all risk estimators.
  • This repository uses Hydra to manage configs.

    • Look at conf/config.yaml or one of the experiments in conf/... for default configs and hyperparameters.
    • Experiments are autologged and results saved to ./output/.
  • See notebooks/eplore_experiment.ipynb for some example code on how to evaluate custom experiments.

    • The evaluations use activetesting.visualize.Visualiser which implements visualisation methods.
    • Give it a path to an experiment in output/path/to/experiment and explore the methods.
    • If you want to combine data from multiple runs, give it a list of paths.
    • I prefer to load this in Jupyter Notebooks, but hey, everybody's different.
  • A guide to the code

    • main.py runs repeated experiments and orchestrates the whole shebang.
      • It iterates through all n_runs and acquisition strategies.
    • experiment.py handles a single experiment.
      • It combines the model, dataset, acquisition strategy, and risk estimators.
    • datasets.py, aquisition.py, loss.py, risk_estimators.py all contain exactly what you would expect!
    • hoover.py is a logging module.
    • models/ contains all models, scikit-learn and pyTorch.
      • In sk2torch.py we have some code that wraps torch models in a way that lets them be used as scikit-learn models from the outside.

And Finally

Thanks for stopping by!

If you find anything wrong with the code, please contact us.

We are happy to answer any questions related to the code and project.

You might also like...
Label-Free Model Evaluation with Semi-Structured Dataset Representations
Label-Free Model Evaluation with Semi-Structured Dataset Representations

Label-Free Model Evaluation with Semi-Structured Dataset Representations Prerequisites This code uses the following libraries Python 3.7 NumPy PyTorch

Efficient-GlobalPointer - Pytorch Efficient GlobalPointer
Efficient-GlobalPointer - Pytorch Efficient GlobalPointer

引言 感谢苏神带来的模型,原文地址:https://spaces.ac.cn/archives/8877 如何运行 对应模型EfficientGlobalPoi

The GitHub repository for the paper: “Time Series is a Special Sequence: Forecasting with Sample Convolution and Interaction“.

SCINet This is the original PyTorch implementation of the following work: Time Series is a Special Sequence: Forecasting with Sample Convolution and I

Info and sample codes for "NTU RGB+D Action Recognition Dataset"

"NTU RGB+D" Action Recognition Dataset "NTU RGB+D 120" Action Recognition Dataset "NTU RGB+D" is a large-scale dataset for human action recognition. I

Sample code from the Neural Networks from Scratch book.

Neural Networks from Scratch (NNFS) book code Code from the NNFS book (https://nnfs.io) separated by chapter.

Code release for the ICML 2021 paper "PixelTransformer: Sample Conditioned Signal Generation".

PixelTransformer Code release for the ICML 2021 paper "PixelTransformer: Sample Conditioned Signal Generation". Project Page Installation Please insta

Negative Sample Matters: A Renaissance of Metric Learning for Temporal Grounding
Negative Sample Matters: A Renaissance of Metric Learning for Temporal Grounding

2D-TAN (Optimized) Introduction This is an optimized re-implementation repository for AAAI'2020 paper: Learning 2D Temporal Localization Networks for

A sample pytorch Implementation of ACL 2021 research paper "Learning Span-Level Interactions for Aspect Sentiment Triplet Extraction".

Span-ASTE-Pytorch This repository is a pytorch version that implements Ali's ACL 2021 research paper Learning Span-Level Interactions for Aspect Senti

Omniverse sample scripts - A guide for developing with Python scripts on NVIDIA Ominverse
Omniverse sample scripts - A guide for developing with Python scripts on NVIDIA Ominverse

Omniverse sample scripts ここでは、NVIDIA Omniverse ( https://www.nvidia.com/ja-jp/om

Comments
  • Can this method evaluate precision or recall?

    Can this method evaluate precision or recall?

    This is a great work! When I use it on my own dataset, it performs well when evaluating accuracy by using accuracy_loss. However, I'm wondering if it can evaluate precision or recall unbiasedly as well since in some class-unbalanced case, precision or recall is a more meaningful metric.

    What I've done to evaluate the precision is, preactively updating the dataset.test_idx and dataset.test_remaining to refer to those samples which are predicted as positive by the model. Then I use the accuracy_loss to evaluate precision since they are identical when the testing samples are all predicted as positive by the model.

    But no matter what dataset I use, the variance of active-testing is always close to i.i.d sampling despite the bias is still zero. I hope you can give me some ideas about this. Thank you.

    opened by boyuzz 3
Owner
Jannik Kossen
PhD Student at OATML Oxford
Jannik Kossen
Sample and Computation Redistribution for Efficient Face Detection

Introduction SCRFD is an efficient high accuracy face detection approach which initially described in Arxiv. Performance Precision, flops and infer ti

Sajjad Aemmi 13 Mar 5, 2022
FAMIE is a comprehensive and efficient active learning (AL) toolkit for multilingual information extraction (IE)

FAMIE: A Fast Active Learning Framework for Multilingual Information Extraction

null 18 Sep 1, 2022
An efficient PyTorch implementation of the evaluation metrics in recommender systems.

recsys_metrics An efficient PyTorch implementation of the evaluation metrics in recommender systems. Overview • Installation • How to use • Benchmark

Xingdong Zuo 12 Dec 2, 2022
A graph neural network (GNN) model to predict protein-protein interactions (PPI) with no sample features

A graph neural network (GNN) model to predict protein-protein interactions (PPI) with no sample features

null 2 Jul 25, 2022
Sample Prior Guided Robust Model Learning to Suppress Noisy Labels

PGDF This repo is the official implementation of our paper "Sample Prior Guided Robust Model Learning to Suppress Noisy Labels ". Citation If you use

CVSM Group -  email: czhu@bupt.edu.cn 22 Dec 23, 2022
Automatic labeling, conversion of different data set formats, sample size statistics, model cascade

Simple Gadget Collection for Object Detection Tasks Automatic image annotation Conversion between different annotation formats Obtain statistical info

llt 4 Aug 24, 2022
gym-anm is a framework for designing reinforcement learning (RL) environments that model Active Network Management (ANM) tasks in electricity distribution networks.

gym-anm is a framework for designing reinforcement learning (RL) environments that model Active Network Management (ANM) tasks in electricity distribution networks. It is built on top of the OpenAI Gym toolkit.

Robin Henry 99 Dec 12, 2022
The Hailo Model Zoo includes pre-trained models and a full building and evaluation environment

Hailo Model Zoo The Hailo Model Zoo provides pre-trained models for high-performance deep learning applications. Using the Hailo Model Zoo you can mea

Hailo 50 Dec 7, 2022
Reference implementation of code generation projects from Facebook AI Research. General toolkit to apply machine learning to code, from dataset creation to model training and evaluation. Comes with pretrained models.

This repository is a toolkit to do machine learning for programming languages. It implements tokenization, dataset preprocessing, model training and m

Facebook Research 408 Jan 1, 2023