This function returns the labels predicted for the input instances. If
true_targets are passed as parameter,
the accuracy obtained is printed too.
object of class
list of matrices for test data.
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
It gives the predictions for the test data using the model saved in the object, which has been previously trained with
train function. If the
true_targets are indicated, the confusion matrix and obtained accuracy value are
The values returned by the LDA
predict function, a list with these components:
class The MAP classification (a factor)
posterior Posterior probabilities for the classes
x The scores of test cases on up to dimen discriminant variables
true_targets are indicated, two more items are added to the output list:
confusion_matrix The confusion matrix obtained with predicted labels and true labels.
acc The accuracy value obtained for the test instances.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.