Learn R Programming

TSEAL (version 0.1.3)

classify.array: Classifies observations based on a pretrained model.

Description

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).

Usage

# S3 method for array
classify(data, model, ...)

Value

A factor with predicted class of each observation

Arguments

data

Sample from the population (dim x length x cases)

model

pretrained discriminant model (lda or qda)

...

Additional arguments

See Also

  • trainModel

Examples

Run this code
# \donttest{
load(system.file("extdata/ECGExample.rda",package = "TSEAL"))
# We simulate that the second series has been obtained after
Series1 <- ECGExample[, , 1:9]
Series2 <- ECGExample[, , 10, drop = FALSE]

# Training a discriminant model
MWA <- 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 data
prediction <- classify(Series2, model)
# }

Run the code above in your browser using DataLab