Class: FeldtRuby::Statistics::CompressionBasedDissimilarityMeasure
- Inherits:
-
StringDistance
- Object
- StringDistance
- FeldtRuby::Statistics::CompressionBasedDissimilarityMeasure
- Defined in:
- lib/feldtruby/statistics/distance/string_distance.rb
Overview
Keogh et al’s CDM.
Instance Method Summary collapse
Methods inherited from StringDistance
Instance Method Details
#distance(string1, string2) ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/feldtruby/statistics/distance/string_distance.rb', line 36 def distance(string1, string2) return 0.0 if string1 == string2 c1 = compressed_length(string1) c2 = compressed_length(string2) c_1_2 = compressed_length(string1 + string2) c_1_2.to_f / (c1 + c2) end |