A fuzzy matching & clustering library for python.
Go to file
Yomguithereal a7b48080dc Drawing of bipartite bfs 2020-10-03 18:44:12 +02:00
cfog Moving C extensions to different package 2020-10-01 10:21:20 +02:00
data Working on projections 2020-10-01 11:23:54 +02:00
docs/img Drawing of bipartite bfs 2020-10-03 18:44:12 +02:00
experiments Experiments about bipartite BFS 2020-10-03 17:30:50 +02:00
fog Abstracting monopartite_projection basic case 2020-10-03 18:10:09 +02:00
test Abstracting monopartite_projection basic case 2020-10-03 18:10:09 +02:00
.gitignore Working projection 2020-10-01 12:18:41 +02:00
.travis.yml Adding make deps 2020-10-02 10:38:23 +02:00
LICENSE.txt Fixing 2018-05-18 15:59:00 +02:00
MANIFEST.in Fixing setup to install without cython 2018-08-23 15:41:34 +02:00
Makefile Adding make deps 2020-10-02 10:38:23 +02:00
Notes.md Notes 2018-12-22 19:13:21 +01:00
README.md hr 2018-06-01 19:59:24 +02:00
requirements.txt wheel in dev deps 2020-10-01 16:51:51 +02:00
setup.py Bump 0.8.1 2020-10-03 15:48:54 +02:00

README.md

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.