rf_test {KnowSeq} | R Documentation

## rf_test allows assessing the final DEGs through a machine learning step by using Random Forest with a test dataset.

### Description

rf_test allows assessing the final DEGs through a machine learning step by using Random Forest with a test dataset.

### Usage

    rf_test(train, labelsTrain, test, labelsTest, vars_selected, bestParameters)

### Arguments

`train` | The train parameter is an expression matrix or data.frame that contains the training dataset with the genes in the columns and the samples in the rows.
`labelsTrain` | A vector or factor that contains the training labels for each of the samples in the train object.
`test` | The test parameter is an expression matrix or data.frame that contains the test dataset with the genes in the columns and the samples in the rows.
`labelsTest` | A vector or factor that contains the test labels for each of the samples in the test object.
`vars_selected` | The genes selected to classify by using them. It can be the final DEGs extracted with the function `DEGsExtraction` or a custom vector of genes. Furthermore, the ranking achieved by `featureSelection` function can be used as input of this parameter.
`bestParameters` | Best values for ntree and mtry parameters selected during the training phase.

### Value

A list that contains four objects. The confusion matrix, the accuracy, the sensitibity and the specificity for each genes.

### Examples

    dir <- system.file("extdata", package="KnowSeq")
    load(paste(dir,"/expressionExample.RData",sep = ""))

    trainingMatrix <- t(DEGsMatrix)[c(1:4,6:9),]
    trainingLabels <- labels[c(1:4,6:9)]
    testMatrix <- t(DEGsMatrix)[c(5,10),]
    testLabels <- labels[c(5,10)]
    bestParameters <- 30
    rf_test(trainingMatrix, trainingLabels, testMatrix, testLabels,rownames(DEGsMatrix)[1:10], bestParameters = bestParameters)

[Package KnowSeq version 1.8.1 Index]