Module: DTW

Defined in:
lib/dtwrb.rb,
lib/dtwrb/bands.rb,
lib/dtwrb/errors.rb,
lib/dtwrb/medoid.rb,
lib/dtwrb/sample.rb,
lib/dtwrb/aligner.rb,
lib/dtwrb/metrics.rb,
lib/dtwrb/version.rb,
lib/dtwrb/resolver.rb,
lib/dtwrb/sequence.rb,
lib/dtwrb/alignment.rb,
lib/dtwrb/resampler.rb,
lib/dtwrb/barycenter.rb,
lib/dtwrb/statistics.rb,
lib/dtwrb/barycenter_averaging.rb,
sig/dtwrb.rbs

Defined Under Namespace

Modules: Bands, Metrics, Resampler, Resolver, Sequence, Statistics, _Band, _Estimator, _Metric Classes: Aligner, Alignment, Barycenter, BarycenterAveraging, DimensionMismatchError, EmptyInputError, Error, InvalidSequenceError, Medoid, Sample, UnknownStrategyError

Constant Summary collapse

VERSION =

Returns:

  • (String)
"1.0.0"

Class Method Summary collapse

Class Method Details

.align(sequence_a, sequence_b, metric: Metrics::DEFAULT, band: Bands::DEFAULT) ⇒ Alignment

Parameters:

  • (sequence)
  • (sequence)
  • metric: (metric) (defaults to: Metrics::DEFAULT)
  • band: (band) (defaults to: Bands::DEFAULT)

Returns:



21
22
23
# File 'lib/dtwrb.rb', line 21

def align(sequence_a, sequence_b, metric: Metrics::DEFAULT, band: Bands::DEFAULT)
  Aligner.new(metric: metric, band: band).align(sequence_a, sequence_b)
end

.barycenter(sequences, length: nil, metric: Metrics::DEFAULT, band: Bands::DEFAULT, **options) ⇒ Barycenter

Parameters:

  • (::Array[untyped])
  • length: (::Integer, nil) (defaults to: nil)
  • metric: (metric) (defaults to: Metrics::DEFAULT)
  • band: (band) (defaults to: Bands::DEFAULT)
  • (Object)

Returns:



33
34
35
36
# File 'lib/dtwrb.rb', line 33

def barycenter(sequences, length: nil, metric: Metrics::DEFAULT, band: Bands::DEFAULT, **options)
  averaging = BarycenterAveraging.new(aligner: Aligner.new(metric: metric, band: band), **options)
  averaging.call(sequences, length: length)
end

.distance(sequence_a, sequence_b, metric: Metrics::DEFAULT, band: Bands::DEFAULT) ⇒ ::Float

Parameters:

  • (sequence)
  • (sequence)
  • metric: (metric) (defaults to: Metrics::DEFAULT)
  • band: (band) (defaults to: Bands::DEFAULT)

Returns:

  • (::Float)


25
26
27
# File 'lib/dtwrb.rb', line 25

def distance(sequence_a, sequence_b, metric: Metrics::DEFAULT, band: Bands::DEFAULT)
  Aligner.new(metric: metric, band: band).distance(sequence_a, sequence_b)
end

.medoid(sequences, metric: Metrics::DEFAULT, band: Bands::DEFAULT, sample_size: Medoid::DEFAULT_SAMPLE_SIZE) ⇒ sequence

Parameters:

  • (::Array[untyped])
  • metric: (metric) (defaults to: Metrics::DEFAULT)
  • band: (band) (defaults to: Bands::DEFAULT)
  • sample_size: (::Integer) (defaults to: Medoid::DEFAULT_SAMPLE_SIZE)

Returns:

  • (sequence)


29
30
31
# File 'lib/dtwrb.rb', line 29

def medoid(sequences, metric: Metrics::DEFAULT, band: Bands::DEFAULT, sample_size: Medoid::DEFAULT_SAMPLE_SIZE)
  Medoid.new(aligner: Aligner.new(metric: metric, band: band), sample_size: sample_size).call(sequences)
end