Skip to main content

A tool for automatic transformation of empirical data distributions

Project description

match_colors

Redistributor

Redistributor is a Python package which forces a collection of scalar samples to follow a desired distribution. When given independent and identically distributed samples of some random variable $S$ and the continuous cumulative distribution function of some desired target $T$, it provably produces a consistent estimator of the transformation $R$ which satisfies $R(S)=T$ in distribution. As the distribution of $S$ or $T$ may be unknown, we also include algorithms for efficiently estimating these distributions from samples. This allows for various interesting use cases in image processing, where Redistributor serves as a remarkably simple and easy-to-use tool that is capable of producing visually appealing results. The package is implemented in Python and is optimized to efficiently handle large data sets, making it also suitable as a preprocessing step in machine learning.

Example of matching colors Matching colors of a reference image – one of the use cases of Redistributor

Installation

pip install redistributor

Quick-start

from redistributor import Redistributor as R
from redistributor import LearnedDistribution as L
from scipy.stats import dgamma, norm

S = dgamma(7).rvs(size=1000)  # Samples from source distribution
target = norm(0, 1)  # In this example, target is set explicitly
r = R(source=L(S), target=target)  # Estimate the transformation
output = r.transform(S)  # Data now follows the target distribution

More in examples.ipynb. Examples for image processing are in examples-images.ipynb.

Documentation

Documentation is available in docs folder.

News & Changelog

  • :hammer: Package is still under development
  • 2024.07 - Preprint on ArXiv updated with new results
  • 2024.07 - Package released on PyPi.org :tada:
  • 2024.07 - Repository mirrored to GitHub for easier access of the community
  • 2023.10 - Added code examples of image processing
  • 2022.10 - Preprint published on ArXiv :tada:
  • 2022.09 - Redistributor v1.0 (complete rewrite)
  • 2021.10 - Redistributor v0.2 (generalization to arbitrary source & target)
  • 2018.08 - Introducing Redistributor (generalization to arbitrary target)
  • 2018.07 - Introducing Gaussifier package (now deprecated)

How to cite

If you use Redistributor in your research, please cite the following paper:

@article{harar2022redistributor,
  title={Redistributor: Transforming Empirical Data Distributions},
  author={Harar, P. and Elbrächter, D. and Dörfler, M. and Johnson, K.},
  eprinttype={ArXiv},
  eprint={2210.14219}
}

License

This project is licensed under the terms of the MIT license. See license.txt for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

redistributor-1.0.0.tar.gz (14.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

redistributor-1.0.0-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

Details for the file redistributor-1.0.0.tar.gz.

File metadata

  • Download URL: redistributor-1.0.0.tar.gz
  • Upload date:
  • Size: 14.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.10

File hashes

Hashes for redistributor-1.0.0.tar.gz
Algorithm Hash digest
SHA256 5b9422b0756744f99a4c00cc645b31b31fc621ef1b476be737b2d90e6f09075e
MD5 455d8e26d6fa6f3bcfdbf98ed2969cd4
BLAKE2b-256 6e295f9a46aa719c340a131b051e7ec9f0e7174162df1f644aeb0869aa5bdacc

See more details on using hashes here.

File details

Details for the file redistributor-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: redistributor-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 13.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.10

File hashes

Hashes for redistributor-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6a7fa82e018024c77148bc13b496c712c8434b133db4201eeaf03061568d130b
MD5 de390284a1e251e0cd8bf75576bf3b18
BLAKE2b-256 46ff266a5d96f6b19fbbdad24751dab0047dfb785d753e3e6632f4382bb1d65e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page