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.3.0.tar.gz
(15.4 kB
view details)
Built Distribution
fog-0.3.0-py3-none-any.whl
(24.0 kB
view details)
File details
Details for the file fog-0.3.0.tar.gz
.
File metadata
- Download URL: fog-0.3.0.tar.gz
- Upload date:
- Size: 15.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a8e47c701ed61a6d1be75bb2d01bacbf403200f956bc90ec8eea7a566ade8b60 |
|
MD5 | 0edca3665dfb8ebd4bf43421e31934c9 |
|
BLAKE2b-256 | bce57c02ab1abbc727a78dec47e0d964ad011a13746764d74110a9146044739c |
File details
Details for the file fog-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: fog-0.3.0-py3-none-any.whl
- Upload date:
- Size: 24.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd91cd22048a1c805b0815eddb7d52f3662ff7b7829544ca67cd63fac676b2d9 |
|
MD5 | ade4dd8639009486b553c7e131da2efc |
|
BLAKE2b-256 | 166500d2338952397d970f473bcae82b38ee52ea5d8d1e72654f769bb4154dde |