Skip to main content

A fuzzy matching & clustering library for python.

Project description

Build Status

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


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.4.0.tar.gz (19.6 kB view details)

Uploaded Source

Built Distribution

fog-0.4.0-py3-none-any.whl (29.4 kB view details)

Uploaded Python 3

File details

Details for the file fog-0.4.0.tar.gz.

File metadata

  • Download URL: fog-0.4.0.tar.gz
  • Upload date:
  • Size: 19.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for fog-0.4.0.tar.gz
Algorithm Hash digest
SHA256 c3cc2de1779623d746447c27e6af890c4420da5a472d8c2a6f9660992794a346
MD5 b4c2d639d981a3a7ef86d9842ac414f2
BLAKE2b-256 8a97429f0fc2d24ee229907784af1b11ffcd2d5a49a948a6f383ff6e7d9af57b

See more details on using hashes here.

File details

Details for the file fog-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for fog-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ef8f6e823362dbd1a1b0de5e98406a98f5c0961d3c6f77df1c348d052be8b0f2
MD5 7c08401aed57a76434a4c6873e233f44
BLAKE2b-256 74868532da48543c9587cd0c41129a8c69f14b94ed7f171c7c343d4da436f2be

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page