Classifies observations based on a pretrained model.
Classifies observations based on a pretrained model.
This function allows to classify observations based on a pretrained model that could have been obtained in several ways (such as using the train model function).
## S3 method for class 'MultiWaveAnalysis'classify(data, model,...)
Arguments
data: Data to be classified by the model. Remember that it must be an object of type MultiWaveAnalysis. Note that it should have the same variables selected as those used to generate the model.
model: pretrained discriminant model (lda or qda)
...: Additional arguments
Returns
A factor with predicted class of each observation
Examples
load(system.file("extdata/ECGExample.rda",package ="TSEAL"))# We simulate that the second series has been obtained afterSeries1 <- ECGExample[,,1:9]Series2 <- ECGExample[,,10, drop =FALSE]# Training a discriminant modelMWA <- MultiWaveAnalysis(Series1,"haar", features = c("var"))MWADiscrim <- StepDiscrim(MWA, c(rep(1,5), rep(2,4)), maxvars =5, features = c("var"))model <- trainModel(MWADiscrim, c(rep(1,5), rep(2,4)),"linear")# Using the discriminant trained on new dataMWA2 <- MultiWaveAnalysis(Series2,"haar", features = c("var"))MWA2Discrim <- SameDiscrim(MWA2, MWADiscrim)prediction <- classify(MWA2Discrim, model)