Class LCSSDistanceFunction

  extended by de.lmu.ifi.dbs.elki.distance.distancefunction.AbstractPrimitiveDistanceFunction<NumberVector<?,?>,DoubleDistance>
      extended by de.lmu.ifi.dbs.elki.distance.distancefunction.AbstractVectorDoubleDistanceFunction
          extended by de.lmu.ifi.dbs.elki.distance.distancefunction.timeseries.LCSSDistanceFunction
All Implemented Interfaces:
DistanceFunction<NumberVector<?,?>,DoubleDistance>, PrimitiveDistanceFunction<NumberVector<?,?>,DoubleDistance>, PrimitiveDoubleDistanceFunction<NumberVector<?,?>>, InspectionUtilFrequentlyScanned, Parameterizable

@Title(value="Longest Common Subsequence distance function")
@Reference(authors="M. Vlachos, M. Hadjieleftheriou, D. Gunopulos, E. Keogh",
           title="Indexing Multi-Dimensional Time-Series with Support for Multiple Distance Measures",
           booktitle="Proceedings of the ninth ACM SIGKDD international conference on Knowledge discovery and data mining",
public class LCSSDistanceFunction
extends AbstractVectorDoubleDistanceFunction

Provides the Longest Common Subsequence distance for FeatureVectors. Adapted for Java, based on Matlab Code by Michalis Vlachos. Original Copyright Notice: BEGIN COPYRIGHT NOTICE lcsMatching code -- (c) 2002 Michalis Vlachos ( This code is provided as is, with no guarantees except that bugs are almost surely present. Published reports of research using this code (or a modified version) should cite the article that describes the algorithm:

M. Vlachos, M. Hadjieleftheriou, D. Gunopulos, E. Keogh:
Indexing Multi-Dimensional Time-Series with Support for Multiple Distance Measures
In Proc. of 9th SIGKDD, Washington, DC, 2003

Comments and bug reports are welcome. Email to I would also appreciate hearing about how you used this code, improvements that you have made to it. You are free to modify, extend or distribute this code, as long as this copyright notice is included whole and unchanged. END COPYRIGHT NOTICE

Nested Class Summary
static class LCSSDistanceFunction.Parameterizer
          Parameterization class.
Field Summary
private  double pDelta
          Keeps the currently set pDelta.
static OptionID PDELTA_ID
          PDELTA parameter
private  double pEpsilon
          Keeps the currently set pEpsilon.
static OptionID PEPSILON_ID
          PEPSILON parameter
Constructor Summary
LCSSDistanceFunction(double pDelta, double pEpsilon)
Method Summary
 double doubleDistance(NumberVector<?,?> v1, NumberVector<?,?> v2)
          Provides the Longest Common Subsequence distance between the given two vectors.
 boolean equals(Object obj)
 VectorFieldTypeInformation<? super NumberVector<?,?>> getInputTypeRestriction()
          Get the input data type of the function.
Methods inherited from class de.lmu.ifi.dbs.elki.distance.distancefunction.AbstractVectorDoubleDistanceFunction
distance, getDistanceFactory
Methods inherited from class de.lmu.ifi.dbs.elki.distance.distancefunction.AbstractPrimitiveDistanceFunction
instantiate, isMetric, isSymmetric
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface de.lmu.ifi.dbs.elki.distance.distancefunction.DistanceFunction
instantiate, isMetric, isSymmetric

Field Detail


public static final OptionID PDELTA_ID
PDELTA parameter


public static final OptionID PEPSILON_ID
PEPSILON parameter


private double pDelta
Keeps the currently set pDelta.


private double pEpsilon
Keeps the currently set pEpsilon.

Constructor Detail


public LCSSDistanceFunction(double pDelta,
                            double pEpsilon)

pDelta - pDelta
pEpsilon - pEpsilon
Method Detail


public double doubleDistance(NumberVector<?,?> v1,
                             NumberVector<?,?> v2)
Provides the Longest Common Subsequence distance between the given two vectors.

v1 - first Object
v2 - second Object
the Longest Common Subsequence distance between the given two vectors as an instance of DoubleDistance.


public VectorFieldTypeInformation<? super NumberVector<?,?>> getInputTypeRestriction()
Description copied from interface: DistanceFunction
Get the input data type of the function.

Specified by:
getInputTypeRestriction in interface DistanceFunction<NumberVector<?,?>,DoubleDistance>
Specified by:
getInputTypeRestriction in interface PrimitiveDistanceFunction<NumberVector<?,?>,DoubleDistance>
getInputTypeRestriction in class AbstractVectorDoubleDistanceFunction
Type restriction


public boolean equals(Object obj)
equals in class Object

Release 0.4.0 (2011-09-20_1324)