Skip to content

arthir/empirical_calibration

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Python Library For Empirical Calibration

Dealing with biased data samples is a common task across many statistical fields. In survey sampling, bias often occurs due to the unrepresentative samples. In causal studies with observational data, the treated vs untreated group assignment is often correlated with covariates, i.e., not random. Empirical calibration is a generic weighting method that presents a unified view on correcting or reducing the data biases for the tasks mentioned above. We provide a Python library EC to compute the empirical calibration weights. The problem is formulated as a convex optimization and solved efficiently in the dual form. Compared to existing software, EC is both more efficient and robust. EC also accommodates different optimization objectives, supports weight clipping, and allows inexact calibration which improves the usability. We demonstrate its usage across various experiments with both simulated and real-world data.

Paper

Wang, Xiaojing, Miao, Jingang, and Sun, Yunting. (2019). A Python Library For Empirical Calibration. arXiv preprint arXiv:1906.11920.

Installation

The easiest way is propably using pip:

pip install -q git+https://github.com/google/empirical_calibration

If you are using a machine without admin rights, you can do:

pip install -q git+https://github.com/google/empirical_calibration --user

If you are using Google Colab, just add "!" to the beginning:

!pip install -q git+https://github.com/google/empirical_calibration

Package works for python 2 and python 3, although we may stop supporting python 2 in the future.

Usage

Package can be imported as

import empirical_calibration as ec

The best way to learn how to use the package is probably by following one of the notebooks, and the recommended way of opening them is Google Colab.

People

Package is created and maintained by Xiaojing Wang, Jingang Miao, and Yunting Sun.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 97.4%
  • Python 2.4%
  • Starlark 0.2%