Skip to main content

dictances

Travis CI build SonarCloud Quality SonarCloud Maintainability Codacy Maintainability Maintainability Pypi project Pypi total project downloads

Distances and divergences between distributions implemented in python.

How do I install this package?

As usual, just download it using pip:

pip install dictances

Tests Coverage

Since some software handling coverages sometime get slightly different results, here’s three of them:

Coveralls Coverage SonarCloud Coverage Code Climate Coverate

Available metrics

A number of distances and divergences are available:

Distances

Methods

Bhattacharyya distance

bhattacharyya

Bhattacharyya coefficient

bhattacharyya_coefficient

Canberra distance

canberra

Chebyshev distance

chebyshev

Chi Square distance

chi_square

Cosine Distance

cosine

Euclidean distance

euclidean

Hamming distance

hamming

Jensen-Shannon divergence

jensen_shannon

Kullback-Leibler divergence

kullback_leibler

Mean absolute error

mae

Taxicab geometry

manhattan, cityblock, total_variation

Minkowski distance

minkowsky

Mean squared error

mse

Pearson’s distance

pearson

Squared deviations from the mean

squared_variation

Usage example

from dictances import cosine

cosine(my_first_dictionary, my_second_dictionary)

Handling nested dictionaries

If you need to compute the distance between two nested dictionaries you can use deflate_dict as follows:

from dictances import cosine
from deflate_dict import deflate

my_first_dictionary = {
    "a": 8,
    "b": {
        "c": 3,
        "d": 6
    }
}

my_second_dictionary = {
    "b": {
        "c": 8,
        "d": 1
    },
    "y": 3,

}

cosine(deflate(my_first_dictionary), deflate(my_second_dictionary))

Release files for dictances 1.5.2

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

Source distribution (sdist)

Source distribution for dictances 1.5.2
File Size Uploaded
dictances-1.5.2.tar.gz 8.6 kB Details

Release files / dictances-1.5.2.tar.gz

Download URL dictances-1.5.2.tar.gz
Size 8.6 kB
Tags Source
SHA-256 checksum
How to use checksums
66cbe49c272baf4101a0a6504c8129f6a79399d2167d990fd378b8deed5d878a
BLAKE2b-256 checksum
How to use checksums
bd49a5a430d3a74f43e29c9481ab830cd0353142e3cf70cd2da659132ee5a948
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

Release history Release notifications | RSS feed

1.5.6

1 release file

1.5.5

1 release file

1.5.4

1 release file

1.5.3

1 release file

This release

1.5.2 This release

1 release file

1.5.1

1 release file

1.5.0

1 release file

1.4.4

1 release file

1.4.3

1 release file

1.4.2

1 release file

1.4.1

1 release file

1.4.0

1 release file

1.3.0

1 release file

1.2.0

1 release file

1.1.4

1 release file

1.1.3

1 release file

1.1.2

1 release file

1.1.1

1 release file

1.1.0

1 release file

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