Mercurial Hosting > traffic-intelligence
annotate trafficintelligence/tests/utils.txt @ 1267:ad60e5adf084
cleaned interaction categorization and added stationary category
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Wed, 29 May 2024 09:52:42 -0400 |
parents | 77fbd0e2ba7d |
children | bae8de98406f |
rev | line source |
---|---|
1030
aafbc0bab925
moved method around to avoid cross-dependencies
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
1028
diff
changeset
|
1 >>> from trafficintelligence.utils import * |
aafbc0bab925
moved method around to avoid cross-dependencies
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
1028
diff
changeset
|
2 >>> from trafficintelligence.moving import Point |
1250
77fbd0e2ba7d
dltrack works with moving average filtering
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
1034
diff
changeset
|
3 >>> from numpy import array, arange |
31
c000f37c316d
moved tests to independent file, added chi2 computation
Nicolas Saunier <nico@confins.net>
parents:
diff
changeset
|
4 |
742
fe71639f1ee7
merge and added function to up-/lower-case strings
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
733
diff
changeset
|
5 >>> upperCaseFirstLetter('mmmm... donuts') |
743
4b3518f6dd01
tests for upperCaseFirstLetter
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
742
diff
changeset
|
6 'Mmmm... Donuts' |
4b3518f6dd01
tests for upperCaseFirstLetter
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
742
diff
changeset
|
7 >>> s = upperCaseFirstLetter('much ado about nothing') |
4b3518f6dd01
tests for upperCaseFirstLetter
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
742
diff
changeset
|
8 >>> s == 'Much Ado About Nothing' |
4b3518f6dd01
tests for upperCaseFirstLetter
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
742
diff
changeset
|
9 True |
4b3518f6dd01
tests for upperCaseFirstLetter
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
742
diff
changeset
|
10 >>> upperCaseFirstLetter(s) == s |
4b3518f6dd01
tests for upperCaseFirstLetter
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
742
diff
changeset
|
11 True |
742
fe71639f1ee7
merge and added function to up-/lower-case strings
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
733
diff
changeset
|
12 |
31
c000f37c316d
moved tests to independent file, added chi2 computation
Nicolas Saunier <nico@confins.net>
parents:
diff
changeset
|
13 >>> computeChi2([],[]) |
878
8e8ec4ece66e
minor + bug corrected in motion pattern learning
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
743
diff
changeset
|
14 0 |
997
4f3387a242a1
updated utils to python 3
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
878
diff
changeset
|
15 >>> computeChi2(list(range(1,10)),list(range(1,10))) |
31
c000f37c316d
moved tests to independent file, added chi2 computation
Nicolas Saunier <nico@confins.net>
parents:
diff
changeset
|
16 0.0 |
997
4f3387a242a1
updated utils to python 3
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
878
diff
changeset
|
17 >>> computeChi2(list(range(1,9)),list(range(1,10))) |
31
c000f37c316d
moved tests to independent file, added chi2 computation
Nicolas Saunier <nico@confins.net>
parents:
diff
changeset
|
18 0.0 |
c000f37c316d
moved tests to independent file, added chi2 computation
Nicolas Saunier <nico@confins.net>
parents:
diff
changeset
|
19 |
32 | 20 >>> ceilDecimals(1.23, 0) |
21 2.0 | |
22 >>> ceilDecimals(1.23, 1) | |
23 1.3 | |
24 | |
152
74b1fc68d4df
re-organized code to avoid cyclic python module dependencies
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
42
diff
changeset
|
25 >>> inBetween(1,2,1.5) |
74b1fc68d4df
re-organized code to avoid cyclic python module dependencies
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
42
diff
changeset
|
26 True |
74b1fc68d4df
re-organized code to avoid cyclic python module dependencies
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
42
diff
changeset
|
27 >>> inBetween(2.1,1,1.5) |
74b1fc68d4df
re-organized code to avoid cyclic python module dependencies
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
42
diff
changeset
|
28 True |
74b1fc68d4df
re-organized code to avoid cyclic python module dependencies
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
42
diff
changeset
|
29 >>> inBetween(1,2,0) |
74b1fc68d4df
re-organized code to avoid cyclic python module dependencies
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
42
diff
changeset
|
30 False |
31
c000f37c316d
moved tests to independent file, added chi2 computation
Nicolas Saunier <nico@confins.net>
parents:
diff
changeset
|
31 |
c000f37c316d
moved tests to independent file, added chi2 computation
Nicolas Saunier <nico@confins.net>
parents:
diff
changeset
|
32 >>> removeExtension('test-adfasdf.asdfa.txt') |
c000f37c316d
moved tests to independent file, added chi2 computation
Nicolas Saunier <nico@confins.net>
parents:
diff
changeset
|
33 'test-adfasdf.asdfa' |
c000f37c316d
moved tests to independent file, added chi2 computation
Nicolas Saunier <nico@confins.net>
parents:
diff
changeset
|
34 >>> removeExtension('test-adfasdf') |
c000f37c316d
moved tests to independent file, added chi2 computation
Nicolas Saunier <nico@confins.net>
parents:
diff
changeset
|
35 'test-adfasdf' |
42
1a2ac2d4f53a
added loading of the rest of the data for objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
32
diff
changeset
|
36 |
1a2ac2d4f53a
added loading of the rest of the data for objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
32
diff
changeset
|
37 >>> values = line2Ints('1 2 3 5 6') |
1a2ac2d4f53a
added loading of the rest of the data for objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
32
diff
changeset
|
38 >>> values[0] |
1a2ac2d4f53a
added loading of the rest of the data for objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
32
diff
changeset
|
39 1 |
1a2ac2d4f53a
added loading of the rest of the data for objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
32
diff
changeset
|
40 >>> values[-1] |
1a2ac2d4f53a
added loading of the rest of the data for objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
32
diff
changeset
|
41 6 |
1a2ac2d4f53a
added loading of the rest of the data for objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
32
diff
changeset
|
42 >>> values = line2Floats('1.3 2.45 7.158e+01 5 6') |
1a2ac2d4f53a
added loading of the rest of the data for objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
32
diff
changeset
|
43 >>> values[0] |
1a2ac2d4f53a
added loading of the rest of the data for objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
32
diff
changeset
|
44 1.3 |
1a2ac2d4f53a
added loading of the rest of the data for objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
32
diff
changeset
|
45 >>> values[2] #doctest: +ELLIPSIS |
1a2ac2d4f53a
added loading of the rest of the data for objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
32
diff
changeset
|
46 71.5... |
1a2ac2d4f53a
added loading of the rest of the data for objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
32
diff
changeset
|
47 >>> values[-1] |
1a2ac2d4f53a
added loading of the rest of the data for objects
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
32
diff
changeset
|
48 6.0 |
285
5957aa1d69e1
Integrating Mohamed's changes
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
152
diff
changeset
|
49 |
1250
77fbd0e2ba7d
dltrack works with moving average filtering
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
1034
diff
changeset
|
50 >>> filterMovingWindow(arange(10), 3) |
77fbd0e2ba7d
dltrack works with moving average filtering
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
1034
diff
changeset
|
51 array([0., 1., 2., 3., 4., 5., 6., 7., 8., 9.]) |
77fbd0e2ba7d
dltrack works with moving average filtering
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
1034
diff
changeset
|
52 >>> filterMovingWindow(list(range(10)), 3) |
77fbd0e2ba7d
dltrack works with moving average filtering
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
1034
diff
changeset
|
53 array([0., 1., 2., 3., 4., 5., 6., 7., 8., 9.]) |
77fbd0e2ba7d
dltrack works with moving average filtering
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
1034
diff
changeset
|
54 >>> filterMovingWindow(arange(10.), 3) |
77fbd0e2ba7d
dltrack works with moving average filtering
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
1034
diff
changeset
|
55 array([0., 1., 2., 3., 4., 5., 6., 7., 8., 9.]) |
77fbd0e2ba7d
dltrack works with moving average filtering
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
1034
diff
changeset
|
56 >>> filterMovingWindow(arange(10.), 2) |
77fbd0e2ba7d
dltrack works with moving average filtering
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
1034
diff
changeset
|
57 array([0., 1., 2., 3., 4., 5., 6., 7., 8., 9.]) |
77fbd0e2ba7d
dltrack works with moving average filtering
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
1034
diff
changeset
|
58 |
297
f6f423e25c7f
adding function to generate step plots (for cumulative number of vehicles)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
285
diff
changeset
|
59 >>> stepPlot([3, 5, 7, 8], 1, 10, 0) |
f6f423e25c7f
adding function to generate step plots (for cumulative number of vehicles)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
285
diff
changeset
|
60 ([1, 3, 3, 5, 5, 7, 7, 8, 8, 10], [0, 0, 1, 1, 2, 2, 3, 3, 4, 4]) |
f6f423e25c7f
adding function to generate step plots (for cumulative number of vehicles)
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
285
diff
changeset
|
61 |
455
abe0b2347d4c
added most common utility function
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
374
diff
changeset
|
62 >>> mostCommon(['a','b','c','b']) |
abe0b2347d4c
added most common utility function
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
374
diff
changeset
|
63 'b' |
abe0b2347d4c
added most common utility function
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
374
diff
changeset
|
64 >>> mostCommon(['a','b','c','b', 'c']) |
abe0b2347d4c
added most common utility function
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
374
diff
changeset
|
65 'b' |
997
4f3387a242a1
updated utils to python 3
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
878
diff
changeset
|
66 >>> mostCommon(list(range(10))+[1]) |
455
abe0b2347d4c
added most common utility function
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
374
diff
changeset
|
67 1 |
1034
4069d8545922
updated mostCommong function
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
1030
diff
changeset
|
68 >>> mostCommon([(1,2), (2,3), (1,2)]) |
4069d8545922
updated mostCommong function
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
1030
diff
changeset
|
69 (1, 2) |
455
abe0b2347d4c
added most common utility function
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
374
diff
changeset
|
70 |
997
4f3387a242a1
updated utils to python 3
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
878
diff
changeset
|
71 >>> res = sortByLength([list(range(3)), list(range(4)), list(range(1))]) |
733 | 72 >>> [len(r) for r in res] |
73 [1, 3, 4] | |
997
4f3387a242a1
updated utils to python 3
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
878
diff
changeset
|
74 >>> res = sortByLength([list(range(3)), list(range(4)), list(range(1)), list(range(5))], reverse = True) |
733 | 75 >>> [len(r) for r in res] |
76 [5, 4, 3, 1] | |
77 | |
689
9990ef119bce
added version of LCSS with cdist computations
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
516
diff
changeset
|
78 >>> lcss = LCSS(similarityFunc = lambda x,y: abs(x-y) <= 0.1) |
997
4f3387a242a1
updated utils to python 3
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
878
diff
changeset
|
79 >>> lcss.compute(list(range(5)), list(range(5))) |
285
5957aa1d69e1
Integrating Mohamed's changes
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
152
diff
changeset
|
80 5 |
997
4f3387a242a1
updated utils to python 3
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
878
diff
changeset
|
81 >>> lcss.compute(list(range(1,5)), list(range(5))) |
285
5957aa1d69e1
Integrating Mohamed's changes
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
152
diff
changeset
|
82 4 |
997
4f3387a242a1
updated utils to python 3
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
878
diff
changeset
|
83 >>> lcss.compute(list(range(5,10)), list(range(5))) |
285
5957aa1d69e1
Integrating Mohamed's changes
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
152
diff
changeset
|
84 0 |
997
4f3387a242a1
updated utils to python 3
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
878
diff
changeset
|
85 >>> lcss.compute(list(range(5)), list(range(10))) |
322
28661c5887d3
Corrected a major bug for LCSS
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
297
diff
changeset
|
86 5 |
369
027e254f0b53
lcss subclass for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
368
diff
changeset
|
87 >>> lcss.similarityFunc = lambda x,y: x == y |
027e254f0b53
lcss subclass for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
368
diff
changeset
|
88 >>> lcss.compute(['a','b','c'], ['a','b','c', 'd']) |
366
90bdabc06e9f
updated LCSS to be more generic with a single similarity function
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
323
diff
changeset
|
89 3 |
369
027e254f0b53
lcss subclass for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
368
diff
changeset
|
90 >>> lcss.computeNormalized(['a','b','c'], ['a','b','c', 'd']) #doctest: +ELLIPSIS |
027e254f0b53
lcss subclass for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
368
diff
changeset
|
91 1.0 |
027e254f0b53
lcss subclass for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
368
diff
changeset
|
92 >>> lcss.computeNormalized(['a','b','c','x'], ['a','b','c', 'd']) #doctest: +ELLIPSIS |
027e254f0b53
lcss subclass for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
368
diff
changeset
|
93 0.75 |
027e254f0b53
lcss subclass for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
368
diff
changeset
|
94 >>> lcss.compute(['a','b','c'], ['a','b','c', 'd']) |
366
90bdabc06e9f
updated LCSS to be more generic with a single similarity function
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
323
diff
changeset
|
95 3 |
369
027e254f0b53
lcss subclass for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
368
diff
changeset
|
96 >>> lcss.compute(['a','x','b','c'], ['a','b','c','d','x']) |
027e254f0b53
lcss subclass for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
368
diff
changeset
|
97 3 |
027e254f0b53
lcss subclass for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
368
diff
changeset
|
98 >>> lcss.compute(['a','b','c','x','d'], ['a','b','c','d','x']) |
322
28661c5887d3
Corrected a major bug for LCSS
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
297
diff
changeset
|
99 4 |
369
027e254f0b53
lcss subclass for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
368
diff
changeset
|
100 >>> lcss.delta = 1 |
027e254f0b53
lcss subclass for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
368
diff
changeset
|
101 >>> lcss.compute(['a','b','c'], ['a','b','x','x','c']) |
368
2db4e76599a1
implemented subsequence extraction and rearranged arguments
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
366
diff
changeset
|
102 2 |
2db4e76599a1
implemented subsequence extraction and rearranged arguments
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
366
diff
changeset
|
103 |
369
027e254f0b53
lcss subclass for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
368
diff
changeset
|
104 >>> lcss.delta = float('inf') |
027e254f0b53
lcss subclass for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
368
diff
changeset
|
105 >>> lcss.compute(['a','b','c'], ['a','b','c', 'd'], computeSubSequence = True) |
027e254f0b53
lcss subclass for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
368
diff
changeset
|
106 3 |
027e254f0b53
lcss subclass for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
368
diff
changeset
|
107 >>> lcss.subSequenceIndices |
027e254f0b53
lcss subclass for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
368
diff
changeset
|
108 [(0, 0), (1, 1), (2, 2)] |
027e254f0b53
lcss subclass for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
368
diff
changeset
|
109 >>> lcss.compute(['a','b','c'], ['x','a','b','c'], computeSubSequence = True) |
027e254f0b53
lcss subclass for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
368
diff
changeset
|
110 3 |
027e254f0b53
lcss subclass for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
368
diff
changeset
|
111 >>> lcss.subSequenceIndices |
027e254f0b53
lcss subclass for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
368
diff
changeset
|
112 [(0, 1), (1, 2), (2, 3)] |
027e254f0b53
lcss subclass for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
368
diff
changeset
|
113 >>> lcss.compute(['a','g','b','c'], ['a','b','c', 'd'], computeSubSequence = True) |
027e254f0b53
lcss subclass for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
368
diff
changeset
|
114 3 |
027e254f0b53
lcss subclass for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
368
diff
changeset
|
115 >>> lcss.subSequenceIndices |
027e254f0b53
lcss subclass for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
368
diff
changeset
|
116 [(0, 0), (2, 1), (3, 2)] |
322
28661c5887d3
Corrected a major bug for LCSS
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
297
diff
changeset
|
117 |
369
027e254f0b53
lcss subclass for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
368
diff
changeset
|
118 >>> alignedLcss = LCSS(lambda x,y:(abs(x-y) <= 0.1), delta = 2, aligned = True) |
997
4f3387a242a1
updated utils to python 3
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
878
diff
changeset
|
119 >>> alignedLcss.compute(list(range(5)), list(range(5))) |
322
28661c5887d3
Corrected a major bug for LCSS
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
297
diff
changeset
|
120 5 |
997
4f3387a242a1
updated utils to python 3
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
878
diff
changeset
|
121 >>> alignedLcss.compute(list(range(1,5)), list(range(5))) |
366
90bdabc06e9f
updated LCSS to be more generic with a single similarity function
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
323
diff
changeset
|
122 4 |
90bdabc06e9f
updated LCSS to be more generic with a single similarity function
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
323
diff
changeset
|
123 |
997
4f3387a242a1
updated utils to python 3
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
878
diff
changeset
|
124 >>> alignedLcss.compute(list(range(5,10)), list(range(10))) |
366
90bdabc06e9f
updated LCSS to be more generic with a single similarity function
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
323
diff
changeset
|
125 5 |
369
027e254f0b53
lcss subclass for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
368
diff
changeset
|
126 |
027e254f0b53
lcss subclass for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
368
diff
changeset
|
127 >>> lcss.delta = 2 |
997
4f3387a242a1
updated utils to python 3
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
878
diff
changeset
|
128 >>> lcss.compute(list(range(5,10)), list(range(10))) |
322
28661c5887d3
Corrected a major bug for LCSS
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
297
diff
changeset
|
129 0 |
369
027e254f0b53
lcss subclass for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
368
diff
changeset
|
130 >>> alignedLcss.delta = 6 |
997
4f3387a242a1
updated utils to python 3
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
878
diff
changeset
|
131 >>> alignedLcss.compute(list(range(5)), list(range(5))) |
323
efd4dd4665ac
corrected issues with large deltas
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
322
diff
changeset
|
132 5 |
997
4f3387a242a1
updated utils to python 3
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
878
diff
changeset
|
133 >>> alignedLcss.compute(list(range(5)), list(range(6))) |
323
efd4dd4665ac
corrected issues with large deltas
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
322
diff
changeset
|
134 5 |
369
027e254f0b53
lcss subclass for indicators
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
368
diff
changeset
|
135 >>> lcss.delta = 10 |
997
4f3387a242a1
updated utils to python 3
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
878
diff
changeset
|
136 >>> alignedLcss.compute(list(range(1,7)), list(range(6))) |
323
efd4dd4665ac
corrected issues with large deltas
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
322
diff
changeset
|
137 5 |
374
a7af3519687e
finished implementation of aligned LCSS with matching sequence decoded
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
369
diff
changeset
|
138 >>> lcss = LCSS(lambda x,y: x == y, delta = 2, aligned = True) |
997
4f3387a242a1
updated utils to python 3
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
878
diff
changeset
|
139 >>> lcss.compute(list(range(20)), [2,4,6,7,8,9,11,13], True) |
374
a7af3519687e
finished implementation of aligned LCSS with matching sequence decoded
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
369
diff
changeset
|
140 8 |
a7af3519687e
finished implementation of aligned LCSS with matching sequence decoded
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
369
diff
changeset
|
141 >>> lcss.subSequenceIndices |
a7af3519687e
finished implementation of aligned LCSS with matching sequence decoded
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
369
diff
changeset
|
142 [(2, 0), (4, 1), (6, 2), (7, 3), (8, 4), (9, 5), (11, 6), (13, 7)] |
689
9990ef119bce
added version of LCSS with cdist computations
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
516
diff
changeset
|
143 |
9990ef119bce
added version of LCSS with cdist computations
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
516
diff
changeset
|
144 >>> lcss = LCSS(metric = 'cityblock', epsilon = 0.1) |
9990ef119bce
added version of LCSS with cdist computations
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
516
diff
changeset
|
145 >>> lcss.compute([[i] for i in range(5)], [[i] for i in range(5)]) |
9990ef119bce
added version of LCSS with cdist computations
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
516
diff
changeset
|
146 5 |
9990ef119bce
added version of LCSS with cdist computations
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
516
diff
changeset
|
147 >>> lcss.compute([[i] for i in range(1,5)], [[i] for i in range(5)]) |
9990ef119bce
added version of LCSS with cdist computations
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
516
diff
changeset
|
148 4 |
9990ef119bce
added version of LCSS with cdist computations
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
516
diff
changeset
|
149 >>> lcss.compute([[i] for i in range(5,10)], [[i] for i in range(5)]) |
9990ef119bce
added version of LCSS with cdist computations
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
516
diff
changeset
|
150 0 |
9990ef119bce
added version of LCSS with cdist computations
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
516
diff
changeset
|
151 >>> lcss.compute([[i] for i in range(5)], [[i] for i in range(10)]) |
9990ef119bce
added version of LCSS with cdist computations
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
516
diff
changeset
|
152 5 |
9990ef119bce
added version of LCSS with cdist computations
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
516
diff
changeset
|
153 |
997
4f3387a242a1
updated utils to python 3
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
878
diff
changeset
|
154 |