predict.dbcsp | R Documentation |
This function returns the labels predicted for the input instances. If true_targets
are passed as parameter,
the accuracy obtained is printed too.
## S3 method for class 'dbcsp' predict(object, X_test, true_targets=NULL, ...)
object |
object of class |
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. |
... |
not currently used. |
It gives the predictions for the test data using the model saved in the object, which has been previously trained with
the train.dbcsp
function. If the true_targets
are indicated, the confusion matrix and obtained accuracy value are
returned too.
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
If the 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.
dbcsp
, print
, summary
, train
, selectQ
, plot
, boxplot
# 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.