Module: DTW::Metrics::Euclidean
- Defined in:
- lib/dtwrb/metrics.rb,
sig/dtwrb.rbs
Class Method Summary collapse
Class Method Details
.call(left, right) ⇒ ::Float
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/dtwrb/metrics.rb', line 17 def self.call(left, right) Metrics.assert_conformable!(left, right) total = 0.0 axis = 0 while axis < left.length difference = left[axis] - right[axis] total += difference * difference axis += 1 end Math.sqrt(total) end |