computeSimilarity: Compute similarity between time series based on learned...

Description Usage Arguments Value Note Author(s) References See Also Examples

Description

Compute similarity between time series. Raw time series can be provided together with learnPattern object so that the representation for the time series are generated internally and similarity is computed based on these representations. The other option is to provide the representations (instead of raw time series) and to compute the similarity without a need for learnPattern object.

Usage

1
2
3
computeSimilarity(object=NULL,testseries=NULL,refseries=NULL,
   maxdepth=NULL,which.tree=NULL,sim.type=0, terminal=TRUE,
   testrepresentation,refrepresentation)

Arguments

object

an object of class learnPattern.

refseries

reference time series.

testseries

test time series.

maxdepth

maximum depth level to be used to generate representations for similarity computations.

which.tree

array of trees to be used for similarity computation.

sim.type

type of the similarity to compute. If set to zero, dissimilarity (absolute differences of the number of patterns) is computed. If set to one, similarity (minimum number of the matching patterns) is computed.

terminal

TRUE if similarity is computed over the learned representations.

testrepresentation

learned representation for test time series.

refrepresentation

learned representation for reference time series.

Value

A similarity matrix of size “the number of test series“ by “the number of reference series“ is returned. Similarity between test series and reference series is defined as the number of mismatching patterns based on the representation generated by the trees. See LPS paper for details.

Note

Similarity matrix can also be computed over representations if it is generated using predict.learnPattern. This will probably take longer time compared to computing the similarity directly using the ensemble. However, if you are using LPS for retrieval purposes, bounding schemes (such as early abondon) can be used (requires further implementation) with the learned representations.

Author(s)

Mustafa Gokce Baydogan

References

Baydogan, M. G. (2013), “Learned Pattern Similarity“, Homepage: http://www.mustafabaydogan.com/learned-pattern-similarity-lps.html.

See Also

learnPattern, predict.learnPattern

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
data(GunPoint)
set.seed(71)
## Learn patterns on GunPoint training series with default parameters
ensemble=learnPattern(GunPoint$trainseries)

## Find the similarity between test and training series
sim=computeSimilarity(ensemble,GunPoint$testseries,GunPoint$trainseries)

## Find similarity using representations, 
## First generate representations
trainRep=predict(ensemble, GunPoint$trainseries, nodes=TRUE)
testRep=predict(ensemble, GunPoint$testseries, nodes=TRUE)

## Then compute the similarity (city-block distance), 
## takes longer but we keep the representation
sim2=computeSimilarity(testrepresentation=testRep,refrepresentation=trainRep)

## Find the similarity based on first 100 trees
sim=computeSimilarity(ensemble,GunPoint$testseries,GunPoint$trainseries,which.tree=c(1:100))

LPStimeSeries documentation built on May 2, 2019, 8:25 a.m.