Skip to main content
http://ci.appveyor.com/api/projects/status/m0f9fw5b670whkw8?svg=true

Install it

You can install cause_effect via:

$ pip install cause_effect

Alternatively, you can install from the code repository directly:

$ pip install hg+http://bitbucket.org/hyllos/cause_effect

Core Functions

pareto(values)

Is a pareto distribution present for a list of numbers (ratio <= 1)?

mccauses(values)

Which causes have the highest concentration (rank * value)?

mceffects(values)

Which effects have the highest concentration?

separator(values)`

From which value (including) does the highest concentration begin?

causes(values, effects=0.8)

Determine causes for specified share of effects.

effects(values, causes=0.2)

Determine effects for specified share of causes.

Secondary Functions

ratio(values)

entropy divided by control_limit.

entropy(values)

Calculate entropy for values.

control_limit(count)

Calculate control entropy for count number of elements (length of values).

Tertiary Functions

make_causes(count)

Return list of causes that is cumulative percent of count number of elements.

make_effects(values)

Return list of effects that is cumulative percent of values.

make_concentration(values)

Return list of concentration for list of values that is rank * value.

sort_list(values)

Return sorted list of numbers.

Parameters

values is a list of numbers. effects and causes must be a number between 0 and 1 (including). count is the length of the list of values.

Use it

The function pareto tells you whether a pareto distribution is present for a list of numbers:

from pareto import pareto, mccauses, mceffects
pareto([789, 621, 109, 65, 45, 30, 27, 15, 12, 9])
True

Here, we have a pareto distribution present. That is a minority causes a majority of effects.

But which minority causes which majority?

mccauses([789, 621, 109, 65, 45, 30, 27, 15, 12, 9])
0.2
mceffects([789, 621, 109, 65, 45, 30, 27, 15, 12, 9])
0.818815331010453

20% of causes effect 82% of results.

But which values are that 20%?

separator([789, 621, 109, 65, 45, 30, 27, 15, 12, 9])
621

All values greater or equal than 621 are those 20% causing 82% of results.

That’s it.

Dig Deeper

How many causes are required for only 90% of effects?

from pareto import causes, effects
causes([789, 621, 109, 65, 45, 30, 27, 15, 12, 9], 0.9)
0.4

40%.

How many effects are behind only 10% of causes?

effects([789, 621, 109, 65, 45, 30, 27, 15, 12, 9], 0.1)
0.458

45.8%.

How does it work?

pareto calculates the entropy for a list of effects:

from pareto import entropy, control_limit, ratio
entropy([789, 621, 109, 65, 45, 30, 27, 15, 12, 9])
1.9593816735406657

It calculates the entropy for a control group of ten elements. That is the length of our list.

control_limit(10)
2.7709505944546686

It then checks entropy is less or equal than control_limit.

This can be simplified to:

values = [789, 621, 109, 65, 45, 30, 27, 15, 12, 9]
entropy(values) / control_limit(len(values)) <= 1

The left side of the comparison is done by ratio. So, if you want to find out how nearby or far off you are from a pareto distribution, do:

ratio([109, 65, 45, 30, 27, 15, 12, 9])
1.051

If we remove the first two effects, the control_limit will be exceeded by the values. So, we learn here that the pareto distribution disappears with the first two effects.

mccauses and mceffects return the respective share of the causes and effects where concentration (rank * value) is highest.

History

0.2.0 (2016-10-21)

  • Add function separator().

  • Streamline tests.

0.1.0 (2016-10-20)

  • First release on PyPI.

Metadata

Release files for cause-effect 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cause-effect 0.2.0
File Size Uploaded Provenance Actions
cause_effect-0.2.0.tar.gz 5.2 kB Without provenance Details for cause_effect-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cause-effect 0.2.0
File Interpreter ABI Platform Actions
cause_effect-0.2.0-py2.py3-none-any.whl Python 2, Python 3 none any Details for cause_effect-0.2.0-py2.py3-none-any.whl

Total release size: 10.7 kB

Release files / cause_effect-0.2.0.tar.gz

Download URL cause_effect-0.2.0.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
6173c9e76c273f1b35694f0deaa533f4aac0ec4faae3e2b943129d75604889a2
BLAKE2b-256 checksum
How to use checksums
125386ded655a10ba8dfe429132ed2b588e760a7d784fdefc226790d4d7c1bec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / cause_effect-0.2.0-py2.py3-none-any.whl

Download URL cause_effect-0.2.0-py2.py3-none-any.whl
Size 5.5 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
a05072cb38183c06456a53da078c3064427e63e5920bdc71356dde248236d657
BLAKE2b-256 checksum
How to use checksums
cfefbfbb7bb76b2d00bc0c4f3f0703003cfd49f79ff3e3d7b1e8b223c3117319
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for cause-effect 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page