Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (8.0%) to scientific vocabulary
Keywords
Repository
A fuzzy matching & clustering library for python.
Basic Info
- Host: GitHub
- Owner: Yomguithereal
- License: mit
- Language: Python
- Default Branch: master
- Size: 2.1 MB
Statistics
- Stars: 26
- Watchers: 7
- Forks: 2
- Open Issues: 9
- Releases: 0
Topics
Metadata Files
README.md
Fog
A fuzzy matching/clustering library for Python.
Installation
You can install fog with pip with the following command:
pip install fog
Usage
Evaluation
bestmatchingmacro_average
Efficient implementation of the "macro average best matching F1" evaluation metric for clusters.
Note that this metric is not symmetric and will match truth -> predicted.
Arguments
* truth iterable: the truth clusters.
* predicted iterable: the predicted clusters.
* allowadditionalitems ?bool [False]: Whether to allow additional items
that don't exist in truth clusters to be found in predicted ones. Those
additional items will then be ignored when computing the metrics instead
of raising an error when found.
Graph
floatsam_sparsification
Function using an iterative algorithm to try and find the best weight threshold to apply to trim the given graph's edges while keeping the underlying community structures.
It works by iteratively increasing the threshold and stopping as soon as a significant connected component starts to drift away from the principal one.
This is basically a very naive gradient descent with a very naive cost function but it works decently for typical cases.
Arguments
* graph nx.Graph: Graph to sparsify.
* starting_treshold ?float [0.0]: Starting similarity threshold.
* learning_rate ?float [0.05]: How much to increase the threshold
at each step of the algorithm.
* maxdriftersize ?int: Max size of component to detach itself
from the principal one before stopping the algorithm. If not
provided it will default to the logarithm of the graph's total
number of nodes.
* weight ?str [weight wrt networkx conventions]: Name of the weight attribute.
* remove_edges ?bool [False]: Whether to remove edges from the graph
having a weight less than found threshold or not. Note that if
True, this will mutate the given graph.
monopartite_projection
Function computing a monopartite projection of the given bipartite graph. This projection can be basic and create a weighted edge each time two nodes in target partition share a common neighbor. Or it can be weighted and filtered using a similarity metric such as Jaccard or cosine similarity, for instance.
Arguments
* bipartite nx.Graph: Target bipartite graph.
* project str: Name of the partition to project.
* part ?str [bipartite]: Name of the node attribute on which the
graph partition is built e.g. "color" or "type" etc.
* weight ?str [weight]: Name of the weight edge attribute.
* metric ?str [None]: Metric to use. If None, the basic projection
will be returned. Also accepts jaccard, overlap, dice,
cosine or binary_cosine.
* threshold ?float [None]: Optional similarity threshold under which
edges won't be added to the monopartite projection.
* use_topology ?bool: Whether to use the bipartite graph's
topology to attempt a subquadratic time projection. Intuitively,
this works by not computing similarities of all pairs of nodes but
only of pairs of nodes that share at least a common neighbor.
It generally works better than the quadratic approach but can
sometimes hurt your performance by losing time on graph traversals
when your graph is very dense.
* bipartition_check ?bool: This function will start by checking
whether your graph is bipartite because it can get stuck in an
infinite loop if given graph is not truly bipartite. Be sure to
disable this kwarg if you know beforehand that your graph is
bipartite and for better performance.
Keyers
omission_key
Function returning a string's omission key which is constructed thusly: 1. First we record the string's set of consonant in an order where most frequently mispelled consonants will be last. 2. Then we record the string's set of vowels in the order of first appearance.
This key is very useful when searching for mispelled strings because if sorted using this key, similar strings will be next to each other.
Arguments * string str: The string to encode.
skeleton_key
Function returning a string's skeleton key which is constructed thusly: 1. The first letter of the string 2. Unique consonants in order of appearance 3. Unique vowels in order of appearance
This key is very useful when searching for mispelled strings because if sorted using this key, similar strings will be next to each other.
Arguments * string str: The string to encode.
Metrics
cosine_similarity
Function computing the cosine similarity of the given sequences. Runs in O(n), n being the sum of A & B's sizes.
Arguments * A iterable: First sequence. * B iterable: Second sequence.
sparsecosinesimilarity
Function computing cosine similarity on sparse weighted sets represented as python dicts.
Runs in O(n), n being the sum of A & B's sizes.
```python from fog.metrics import sparsecosinesimilarity
Basic
sparsecosinesimilarity({'apple': 34, 'pear': 3}, {'pear': 1, 'orange': 1})
~0.062 ```
Arguments * A Counter: First weighted set. * B Counter: Second weighted set.
sparsedotproduct
Function used to compute the dotproduct of sparse weighted sets represented by python dicts.
Runs in O(n), n being the size of the smallest set.
Arguments * A Counter: First weighted set. * B Counter: Second weighted set.
binarycosinesimilarity
Function computing the binary cosine similarity of the given sequences. Runs in O(n), n being the size of the smallest set.
Arguments * A iterable: First sequence. * B iterable: Second sequence.
sparsebinarycosine_similarity
Function computing binary cosine similarity on sparse vectors represented as python sets.
Runs in O(n), n being the size of the smaller set.
Arguments * A Counter: First set. * B Counter: Second set.
dice_coefficient
Function computing the Dice coefficient. That is to say twice the size of the intersection of both sets divided by the sum of both their sizes.
Runs in O(n), n being the size of the smallest set.
```python from fog.metrics import dice_coefficient
Basic
dice_coefficient('context', 'contact')
~0.727 ```
Arguments * A iterable: First sequence. * B iterable: Second sequence.
jaccard_similarity
Function computing the Jaccard similarity. That is to say the intersection of input sets divided by their union.
Runs in O(n), n being the size of the smallest set.
```python from fog.metrics import jaccard_similarity
Basic
jaccard_similarity('context', 'contact')
~0.571 ```
Arguments * A iterable: First sequence. * B iterable: Second sequence.
weightedjaccardsimilarity
Function computing the weighted Jaccard similarity. Runs in O(n), n being the sum of A & B's sizes.
```python from fog.metrics import weightedjaccardsimilarity
Basic
weightedjaccardsimilarity({'apple': 34, 'pear': 3}, {'pear': 1, 'orange': 1})
~0.026 ```
Arguments * A Counter: First weighted set. * B Counter: Second weighted set.
overlap_coefficient
Function computing the overlap coefficient of the given sets, i.e. the size of their intersection divided by the size of the smallest set.
Runs in O(n), n being the size of the smallest set.
Arguments * A iterable: First sequence. * B iterable: Second sequence.
Owner
- Name: Guillaume Plique
- Login: Yomguithereal
- Kind: user
- Location: France
- Company: médialab - Sciences Po
- Website: https://yomguithereal.github.io/
- Repositories: 102
- Profile: https://github.com/Yomguithereal
GitHub Events
Total
- Pull request event: 1
- Fork event: 1
Last Year
- Pull request event: 1
- Fork event: 1
Committers
Last synced: over 2 years ago
Top Committers
| Name | Commits | |
|---|---|---|
| Yomguithereal | g****e@g****m | 469 |
| WilliamDiakite | w****e@g****m | 2 |
Issues and Pull Requests
Last synced: 11 months ago
All Time
- Total issues: 30
- Total pull requests: 2
- Average time to close issues: 25 days
- Average time to close pull requests: 1 day
- Total issue authors: 1
- Total pull request authors: 2
- Average comments per issue: 0.13
- Average comments per pull request: 0.5
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- Yomguithereal (30)
Pull Request Authors
- Yomguithereal (1)
- jimenaRL (1)
- WilliamDiakite (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 421 last-month
- Total dependent packages: 1
- Total dependent repositories: 1
- Total versions: 34
- Total maintainers: 1
pypi.org: fog
A fuzzy matching & clustering library for python.
- Homepage: http://github.com/Yomguithereal/fog
- Documentation: https://fog.readthedocs.io/
- License: MIT
-
Latest release: 0.12.0
published 12 months ago
Rankings
Maintainers (1)
Dependencies
- Unidecode ==1.0.22
- cython ==0.28.4
- dill ==0.3.2
- docstring-parser ==0.7.3
- ebbe ==1.3.1
- emoji ==1.2.0
- importchecker ==2.0
- networkx >=2
- numpy ==1.14.3
- phylactery ==0.1.1
- progressbar2 ==3.38.0
- pycodestyle ==2.4.0
- pytest ==3.5.1
- python-Levenshtein ==0.12.0
- twine ==1.11.0
- wheel *
- Unidecode >=1.0.22
- dill >=0.2.7.1
- ebbe >=1.3.1,<2
- emoji >=1
- networkx >=2
- phylactery >=0.1.1