comparison scripts/performance-lcss.py @ 746:e7ff0f60fef8

merged new developments (indicator and trajectory clustering)
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Thu, 10 Sep 2015 15:52:45 -0400
parents a850a4f92735
children 933670761a57
comparison
equal deleted inserted replaced
727:c6d4ea05a2d0 746:e7ff0f60fef8
1 #! /usr/bin/env python
2
3 import timeit
4
5 vectorLength = 10
6 number = 10
7
8 print('Default Python implementation with lambda')
9 print timeit.timeit('lcss.compute(random_sample(({},2)), random_sample(({}, 2)))'.format(vectorLength, vectorLength*2), setup = 'from utils import LCSS; from numpy.random import random_sample; lcss = LCSS(similarityFunc = lambda x,y: (abs(x[0]-y[0]) <= 0.1) and (abs(x[1]-y[1]) <= 0.1));', number = number)
10
11 print('Using scipy distance.cdist')
12 print timeit.timeit('lcss.compute(random_sample(({},2)), random_sample(({}, 2)))'.format(vectorLength, vectorLength*2), setup = 'from utils import LCSS; from numpy.random import random_sample; lcss = LCSS(metric = "cityblock", epsilon = 0.1);', number = number)