Package to help with the propagation of uncertainty when disaggregating data, using the maximum entropy principle.
Project description
maxent_disaggregation
maxent_disaggregation is a python package to help with the propagation of uncertainty when disaggregating data, based on the maximum entropy principle. It samples from various forms of the Dirichlet distribution, maximising the entropy based on the available information.
Installation
You can install maxent_disaggregation via pip from PyPI:
$ pip install maxent_disaggregation
The goal of maxent_disaggregation is to provide an easy to use Python tool
that helps you with uncertainty propagation when data disaggregation is involved. Data
disaggregation usually involves splitting one data point $$Y_0$$ into $$K$$
disaggregate quantities $$Y_1, Y_2, ..., Y_K$$ using proxy data. It is a common
problem in many different research disciplines.
flowchart-elk TD
%% Define node classes
classDef Aggregate fill:#eeeee4,color:black,stroke:none;
classDef DisAgg1 fill:#abdbe3,color:black,stroke:none;
classDef DisAgg2 fill:#e28743,color:black,stroke:none;
classDef DisAgg3 fill:#abdbe3,color:black,stroke:none;
agg("Y_0"):::Aggregate
disagg1("Y_1=x_1 Y_0"):::DisAgg1
disagg2("Y_2=x_2 Y_0"):::DisAgg1
disagg3("Y_3=x_3 Y_0"):::DisAgg1
%% Define connections
agg --> disagg1
agg --> disagg2
agg --> disagg3
For more detailed description of the package, theory please see the documentation page. For a quickstart see below:
Quick start
from maxent_disaggregation import maxent_disagg
import numpy as np
# best guess or mean of the total quantity Y_0 (if available)
mean_aggregate = 10
# best guess of the standard deviation of the total quantity Y_0 (if available)
sd_aggregate = 1
# min/max value of the total quantity Y_o (if applicable/available) (optional)
min_aggregate = 0
max_aggregate = np.inf
# best guess values and uncertainties from proxy data for the shares (x_i) if available (of not available put in np.nan)
shares_disaggregates = [0.4, 0.25, 0.2, 0.15]
sds_shares = [0.1, np.nan, 0.04, 0.001]
# Now draw 10000 samples
samples, _ = maxent_disagg(n=10000,
mean_0=mean_aggregate,
sd_0=sd_aggregate,
min_0=min_aggregate,
max_0=max_aggregate,
shares=shares_disaggregates,
sds=sds_shares,
)
# Now plot the sampled distributions
from maxent_disaggregation import plot_samples_hist
# the input values are provided for the legend
plot_samples_hist(samples,
mean_0=mean_aggregate,
sd_0=sd_aggregate,
shares=shares_disaggregates,
sds=sds_shares)
We can also easily plot the covariances between the different disaggrate quantities:
# Plot the covariances between the disaggregates
from maxent_disaggregation import plot_covariances
plot_covariances(samples)
Reference
If you find this package useful please share and cite our paper: [DOI]
Contributing
Contributions are very welcome. To learn more, see the Contributor Guide.
License
Distributed under the terms of the MIT license, maxent_disaggregation is free and open source software.
Issues
If you encounter any problems, please file an issue along with a detailed description.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file maxent_disaggregation-1.0.10.tar.gz.
File metadata
- Download URL: maxent_disaggregation-1.0.10.tar.gz
- Upload date:
- Size: 19.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bd52842b9cae30331d7b9b36868065c93a7efa04a098d812af3b115278e530be
|
|
| MD5 |
1f739a4d66f4f99c06cfbc7d0836881b
|
|
| BLAKE2b-256 |
53631feb2c154e7104503f9cb96fede412cf443fc884fdb8d804791871a15c6d
|
Provenance
The following attestation bundles were made for maxent_disaggregation-1.0.10.tar.gz:
Publisher:
python-package-deploy.yml on jakobsarthur/maxent_disaggregation
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
maxent_disaggregation-1.0.10.tar.gz -
Subject digest:
bd52842b9cae30331d7b9b36868065c93a7efa04a098d812af3b115278e530be - Sigstore transparency entry: 607971428
- Sigstore integration time:
-
Permalink:
jakobsarthur/maxent_disaggregation@e3d176a18e2226b7dd4042a04f72606bb56ff009 -
Branch / Tag:
refs/tags/pypi_release - Owner: https://github.com/jakobsarthur
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-package-deploy.yml@e3d176a18e2226b7dd4042a04f72606bb56ff009 -
Trigger Event:
push
-
Statement type:
File details
Details for the file maxent_disaggregation-1.0.10-py3-none-any.whl.
File metadata
- Download URL: maxent_disaggregation-1.0.10-py3-none-any.whl
- Upload date:
- Size: 17.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b0b7186369133509c90fd6d18b998864ab690dd647e9b98a209f73793e43280e
|
|
| MD5 |
771e7d04c1850308d2b16d1a6f5b9849
|
|
| BLAKE2b-256 |
0c2c203a3042fb84e354fc0f8fc82d1e301efcf33eabb78a424fdd7caa9619a6
|
Provenance
The following attestation bundles were made for maxent_disaggregation-1.0.10-py3-none-any.whl:
Publisher:
python-package-deploy.yml on jakobsarthur/maxent_disaggregation
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
maxent_disaggregation-1.0.10-py3-none-any.whl -
Subject digest:
b0b7186369133509c90fd6d18b998864ab690dd647e9b98a209f73793e43280e - Sigstore transparency entry: 607971438
- Sigstore integration time:
-
Permalink:
jakobsarthur/maxent_disaggregation@e3d176a18e2226b7dd4042a04f72606bb56ff009 -
Branch / Tag:
refs/tags/pypi_release - Owner: https://github.com/jakobsarthur
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-package-deploy.yml@e3d176a18e2226b7dd4042a04f72606bb56ff009 -
Trigger Event:
push
-
Statement type: