Learn R Programming

TSEAL (version 0.1.3)

testModel: Computes a classification from a pretrained discriminant

Description

This function uses a pretrained linear discriminant to classify a set of test data. As output it returns a confusion matrix and optionally the raw classification result.

Usage

testModel(model, test, labels, returnClassification = FALSE, ...)

Value

  • if returnClassification is false return a object of class confusionMatrix

  • if returnClassification is true, it returns a list containing an object of the confusionMatrix class and a vector with the classification result.

Arguments

model

Trained linear discriminant. see trainModel

test

MultiWaveAnalysis class object to be used as test set.

labels

Vector that determines the class to which each of the observations provided in the test set belongs.

returnClassification

Allows to select if the raw result classification is returned.

...

Additional arguments

See Also

testModel

Examples

Run this code
# \donttest{
load(system.file("extdata/ECGExample.rda",package = "TSEAL"))
# The dataset has the first 5 elements of class 1
# and the last 5 of class 2.
labels <- c(rep(1, 5), rep(2, 5))
MWA <- generateStepDiscrim(ECGExample, labels, "haar", maxvars = 5, features = c("var"))
aux <- extractSubset(MWA, c(1, 2, 9, 10))
MWATest <- aux[[1]]
MWATrain <- aux[[2]]
ldaDiscriminant <- trainModel(MWATrain, labels[3:8], "linear")
CM <- testModel(ldaDiscriminant, MWATest, labels[c(1, 2, 9, 10)])
# }

Run the code above in your browser using DataLab