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

Uploaded Source

Built Distribution

fog-0.5.0-cp37-cp37m-macosx_10_13_x86_64.whl (70.9 kB view details)

Uploaded CPython 3.7m macOS 10.13+ x86-64

File details

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

File metadata

  • Download URL: fog-0.5.0.tar.gz
  • Upload date:
  • Size: 63.2 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

Hashes for fog-0.5.0.tar.gz
Algorithm Hash digest
SHA256 6a6460e21498e76b6b162de4f91ebd5f1b2c156ac21e9b494f93721a160f3b84
MD5 796cf9af27f35d2a57a66b646a842708
BLAKE2b-256 3484e6aca2dbea38c594988029567d417e7f42f83e596a6194c927e65337aab6

See more details on using hashes here.

File details

Details for the file fog-0.5.0-cp37-cp37m-macosx_10_13_x86_64.whl.

File metadata

  • Download URL: fog-0.5.0-cp37-cp37m-macosx_10_13_x86_64.whl
  • Upload date:
  • Size: 70.9 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

Hashes for fog-0.5.0-cp37-cp37m-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 623d85abf40c6122f167e166273e09d8fdacdb832689a56b2635146317622230
MD5 56f45af1aaac9d48db32cb4683553104
BLAKE2b-256 f833d70957d861fe2d3e90a465c50f4fb18f2086f2980d0f1eb6404be2395149

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