predict.dbcsp: Predict function implemented by dbcsp class

Description Usage Arguments Details Value See Also Examples

Description

This function returns the labels predicted for the input instances. If true_targets are passed as parameter, the accuracy obtained is printed too.

Usage

1
2
## S3 method for class 'dbcsp'
predict(object, X_test, true_targets=NULL, ...)

Arguments

object

object of class dbcsp.

X_test

list of matrices for test data.

true_targets

vector of true labels of the instances. Note that they must match the names of the labels used when training the model.

...

optional arguments inherited from the generic predict method.

Details

It gives the predictions for the test data using the model saved in the object, which has been previously trained with the train function. If the true_targets are indicated, the confusion matrix and obtained accuracy value are returned too.

Value

The values returned by the LDA predict function, a list with these components:

If the true_targets are indicated, two more items are added to the output list:

See Also

dbcsp, print, summary, train, selectQ, plot, boxplot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# Read data from 2 classes
x <- AR.data$come[1:20]
y <- AR.data$five[1:20]
mydbcsp <- new("dbcsp", X1 = x, X2 = y)
mydbcsp <- train(mydbcsp,fold=3)
test_data <- c(AR.data$come[20:24], AR.data$five[20:24])
test_labels <- c(rep('x',5),rep('y',5))
predictions <- predict(mydbcsp,test_data,test_labels)
# Predicted classes
print(predictions$class)
# Confusion matrix
print(predictions$confusion_matrix)
# Accuracy
print(predictions$acc)

dbcsp documentation built on July 9, 2021, 9:08 a.m.