predict.learnPattern: predict method for 'learnPattern' objects

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

Description

Representation generation for test data using learnPattern.

Usage

1
2
3
## S3 method for class 'learnPattern'
predict(object, newdata, which.tree=NULL,
   nodes=TRUE, maxdepth=NULL, ...)

Arguments

object

an object of class learnPattern, as that created by the function learnPattern.

newdata

a data frame or matrix containing new data.

which.tree

NULL if the representation is needed to be generated over all trees of ensemble. Set to an integer value if the representation is required to be generated for one tree specified by the value set.

nodes

TRUE generates the representation based on the trees. . FALSE generates a real-valued prediction for each time point.

maxdepth

The maximum depth level to generate the representation

...

not used currently.

Value

Returns the learned pattern representation for the time series in the dataset if nodes is set TRUE. Basically, it is the count of observed patterns at each terminal node. Otherwise predicted values for each time series in newdata are returned.

Author(s)

Mustafa Gokce Baydogan

References

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

Breiman, L. (2001), Random Forests, Machine Learning 45(1), 5-32.

See Also

learnPattern

Examples

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

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

## Check size of the representation for training data
print(dim(trainRep))

## Learn patterns on GunPoint training series (target cannot be difference series)
ensemble=learnPattern(GunPoint$trainseries,target.diff=FALSE)

## Predict observations for test time series
predicted=predict(ensemble,GunPoint$testseries,nodes=FALSE)

## Plot an example test time series 
plot(GunPoint$testseries[5,],type='l',lty=1,xlab='Time',ylab='Observation',lwd=2)
points(c(1:ncol(GunPoint$testseries)),predicted$predictions[5,],type='l',col=2,lty=2,lwd=2)
legend('topleft',c('Original series','Approximation'),col=c(1,2),lty=c(1,2),lwd=2)

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