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.7.0.tar.gz
(69.8 kB
view details)
Built Distribution
File details
Details for the file fog-0.7.0.tar.gz
.
File metadata
- Download URL: fog-0.7.0.tar.gz
- Upload date:
- Size: 69.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | aedf4ffbed8f3982d8bb9c72bc52bc05bd1e95f67d88eba98fe85ea3f5e58a60 |
|
MD5 | f13eca3d8421d7144694a5f438144353 |
|
BLAKE2b-256 | 9d426da9abf5488067c5cd1db3a4b696aaaa04ebb6f0a03c6bfdf5c33bdccecd |
File details
Details for the file fog-0.7.0-cp36-cp36m-macosx_10_13_x86_64.whl
.
File metadata
- Download URL: fog-0.7.0-cp36-cp36m-macosx_10_13_x86_64.whl
- Upload date:
- Size: 79.4 kB
- Tags: CPython 3.6m, macOS 10.13+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 560e1631564b6ff4243b33ca209c3ed71cdf1344870d983b3dd8d3f2a9f8ee36 |
|
MD5 | 6dbb7467f3c488232806c73b983d3aff |
|
BLAKE2b-256 | 1c35e900fd9427c29845f38e0858fbccfe98aba5e2db27bb6d1230fb7c00f994 |