A fuzzy matching & clustering library for python.
Project description
Fog
A fuzzy matching/clustering library for Python.
Installation
You can install fog
with pip with the following command:
pip install fog
Usage
Metrics
sparse_cosine_similarity
Computes the cosine similarity of two sparse weighted sets. Those sets have to be represented as counters.
from fog.metrics import sparse_cosine_similarity
# Basic
sparse_cosine_similarity({'apple': 34, 'pear': 3}, {'pear': 1, 'orange': 1})
>>> ~0.062
Arguments
- A Counter: first weighted set. Must be a dictionary mapping keys to weights.
- B Counter: second weighted set. Muset be a dictionary mapping keys to weights.
jaccard_similarity
Computes the Jaccard similarity of two arbitrary iterables.
from fog.metrics import jaccard_similarity
# Basic
jaccard_similarity('context', 'contact')
>>> ~0.571
Arguments
- A iterable: first sequence to compare.
- B iterable: second sequence to compare.
weighted_jaccard_similarity
Computes the weighted Jaccard similarity of two weighted sets. Those sets have to be represented as counters.
from fog.metrics import weighted_jaccard_similarity
# Basic
weighted_jaccard_similarity({'apple': 34, 'pear': 3}, {'pear': 1, 'orange': 1})
>>> ~0.026
Arguments
- A Counter: first weighted set. Must be a dictionary mapping keys to weights.
- B Counter: second weighted set. Muset be a dictionary mapping keys to weights.
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
fog-0.5.4.tar.gz
(64.4 kB
view hashes)
Built Distributions
Close
Hashes for fog-0.5.4-py3.7-macosx-10.13-x86_64.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b9eb152740f85406a6f463168ed0260a7ebdca028b16b13b6508710a1c16532 |
|
MD5 | ad12a5cfb5faa07b434af686d21bf253 |
|
BLAKE2b-256 | 8c542a797a6aeb84154b00992381f4f0ba0fd2f8b4ae3cf99eaae750ee523609 |
Close
Hashes for fog-0.5.4-cp37-cp37m-macosx_10_13_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca3ca86621402804107d05adbd4db1d6f1a11d593883ce146df7b44f05bc713c |
|
MD5 | 20663a6ab59a8d054157be3c49d82018 |
|
BLAKE2b-256 | 674fba7e9b942f080a649941ddde041e24e3bc5efd094f851f759ebbf5565aa2 |