New bench

This commit is contained in:
Yomguithereal 2018-07-06 19:00:57 +02:00
parent 71f6fb2919
commit aa7126f791
1 changed files with 9 additions and 1 deletions

View File

@ -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)