Package ai.libs.jaicore.basic.metric
Class MoveSplitMerge
- java.lang.Object
-
- ai.libs.jaicore.basic.metric.MoveSplitMerge
-
- All Implemented Interfaces:
org.api4.java.common.math.IMetric<double[]>
,IDistanceMetric
public class MoveSplitMerge extends java.lang.Object implements IDistanceMetric
Implementation of the Move-Split-Merge (MSM) measure as published in "The Move-Split-Merge Metric for Time Series" by Alexandra Stefan, Vassilis Athitsos and Gautam Das (2013). The idea behind the MSM metric is to define a set of operations that can be used to transform any time series into any other.- A Move operation changes the value of a single point of the time series.
- A Split operation splits a single point of the time series into two consecutive points that have the same value as the original point.
- A Merge operation merges two consecutive points that have the same value int a single point that has that value.
x
toy
is|x-y|
. The cost for a Split and Merge is defined by a constantc
. LetS = (s_1, s_2, .., s_n)
be a sequence of Move/Split/Merge operations withs_i
either Move, Split or a Merge. The Move-Split-Merge distance between to time seriesA
andB
is defined be the cost of the lowest-cost transformationS*
, such thattransform(S*, A) = B
.
-
-
Constructor Summary
Constructors Constructor Description MoveSplitMerge(double c)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
distance(double[] a, double[] b)
Calculates the distance between two time series.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.api4.java.common.metric.IDistanceMetric
getDistance
-
-
-
-
Method Detail
-
distance
public double distance(double[] a, double[] b)
Description copied from interface:IDistanceMetric
Calculates the distance between two time series.- Specified by:
distance
in interfaceIDistanceMetric
- Parameters:
a
- First time series.b
- Second time series.- Returns:
- Distance between the first and second time series.
-
-