mirror of https://github.com/Yomguithereal/fog.git
New bench
This commit is contained in:
parent
71f6fb2919
commit
aa7126f791
|
@ -3,7 +3,7 @@ from functools import partial
|
||||||
from timeit import default_timer as timer
|
from timeit import default_timer as timer
|
||||||
from fog.clustering import *
|
from fog.clustering import *
|
||||||
from fog.tokenizers import ngrams
|
from fog.tokenizers import ngrams
|
||||||
from fog.key import fingerprint, omission_key
|
from fog.key import fingerprint, omission_key, skeleton_key
|
||||||
from Levenshtein import distance as levenshtein
|
from Levenshtein import distance as levenshtein
|
||||||
|
|
||||||
with open('./data/universities.csv', 'r') as f:
|
with open('./data/universities.csv', 'r') as f:
|
||||||
|
@ -37,6 +37,10 @@ with open('./data/universities.csv', 'r') as f:
|
||||||
clusters = list(sorted_neighborhood(universities, key=omission_key, distance=levenshtein, radius=2))
|
clusters = list(sorted_neighborhood(universities, key=omission_key, distance=levenshtein, radius=2))
|
||||||
print('SNM Omission (%i):' % len(clusters), timer() - start)
|
print('SNM Omission (%i):' % len(clusters), timer() - start)
|
||||||
|
|
||||||
|
start = timer()
|
||||||
|
clusters = list(sorted_neighborhood(universities, key=skeleton_key, distance=levenshtein, radius=2))
|
||||||
|
print('SNM Skeleton (%i):' % len(clusters), timer() - start)
|
||||||
|
|
||||||
print()
|
print()
|
||||||
with open('./data/musicians.csv', 'r') as f:
|
with open('./data/musicians.csv', 'r') as f:
|
||||||
reader = csv.DictReader(f)
|
reader = csv.DictReader(f)
|
||||||
|
@ -61,6 +65,10 @@ with open('./data/musicians.csv', 'r') as f:
|
||||||
clusters = list(sorted_neighborhood(artists, key=omission_key, distance=levenshtein, radius=2))
|
clusters = list(sorted_neighborhood(artists, key=omission_key, distance=levenshtein, radius=2))
|
||||||
print('SNM Omission (%i):' % len(clusters), timer() - start)
|
print('SNM Omission (%i):' % len(clusters), timer() - start)
|
||||||
|
|
||||||
|
start = timer()
|
||||||
|
clusters = list(sorted_neighborhood(artists, key=skeleton_key, distance=levenshtein, radius=2))
|
||||||
|
print('SNM Skeleton (%i):' % len(clusters), timer() - start)
|
||||||
|
|
||||||
start = timer()
|
start = timer()
|
||||||
clusters = list(pairwise_fuzzy_clusters(artists, distance=levenshtein, radius=2, processes=8))
|
clusters = list(pairwise_fuzzy_clusters(artists, distance=levenshtein, radius=2, processes=8))
|
||||||
print('Parallel Fuzzy clusters (%i):' % len(clusters), timer() - start)
|
print('Parallel Fuzzy clusters (%i):' % len(clusters), timer() - start)
|
||||||
|
|
Loading…
Reference in New Issue