testModel function

Computes a classification from a pretrained discriminant

Computes a classification from a pretrained discriminant

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.

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

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

Returns

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

Examples

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

See Also

testModel

  • Maintainer: Iván Velasco
  • License: Artistic-2.0
  • Last published: 2024-07-02