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:
Available metrics
A number of distances and divergences are available:
Distances |
Methods |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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))
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file dictances-1.5.2.tar.gz.
File metadata
- Download URL: dictances-1.5.2.tar.gz
- Upload date:
- Size: 8.6 kB
- Tags: Source
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
66cbe49c272baf4101a0a6504c8129f6a79399d2167d990fd378b8deed5d878a
|
|
| MD5 |
3b3859c9f46d9c9e22d76570dfa79867
|
|
| BLAKE2b-256 |
bd49a5a430d3a74f43e29c9481ab830cd0353142e3cf70cd2da659132ee5a948
|