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.2.tar.gz
(64.5 kB
view details)
Built Distribution
File details
Details for the file fog-0.5.2.tar.gz
.
File metadata
- Download URL: fog-0.5.2.tar.gz
- Upload date:
- Size: 64.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e624f49db4c3a4ddcad0afe071ac43c32c4071a2dcc11339955ea7d9692621cd |
|
MD5 | b577db1e39a9c7e8242ee275d1120019 |
|
BLAKE2b-256 | 9a4670a701e602e12c616e2b37844c0a3747b818e76ef2d0902533ba1905328d |
File details
Details for the file fog-0.5.2-cp37-cp37m-macosx_10_13_x86_64.whl
.
File metadata
- Download URL: fog-0.5.2-cp37-cp37m-macosx_10_13_x86_64.whl
- Upload date:
- Size: 72.5 kB
- Tags: CPython 3.7m, macOS 10.13+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | db4b9fa86ca2a150b6f90c996db2f78cdaea5b613c39514fad72eb7fcb3a39fe |
|
MD5 | e8056bdfcc566770af39ed89fbcc100e |
|
BLAKE2b-256 | 103f913f8855b866757d7c6f5ae292b021d7909aa55cd57d6de2380b824e23f0 |