-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added time-series averaging to example
- Loading branch information
1 parent
481cb13
commit ddf3d03
Showing
3 changed files
with
20 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
let d x y = (x - y) * (x - y); | ||
let avg x y = (x + y) / 2; | ||
let avgSeq seq1 seq2 fn pairs = | ||
let worker seq1 seq2 fn (i, j) = | ||
let x = nth (i - 1) seq1; | ||
y = nth (j - 1) seq2 | ||
in | ||
fn x y | ||
in map (worker seq1 seq2 fn) pairs; | ||
|
||
let seq1 = [3,1,2,2,1]; | ||
seq2 = [2,0,0,3,3,1,0]; | ||
window = 2; | ||
(costs, matched) = computeDTW seq1 seq2 d window | ||
in avgSeq seq1 seq2 avg matched |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters