predictor: Prediction

Description Usage Arguments Value Author(s) Examples

Description

Score each sample with the machine learning-based classification prediction model alreadly trained with training dataset.

Usage

1
predictor(method = c("randomForest", "svm", "nnet" ), classifier, featureMat)

Arguments

method

character string specifying the machine learning algorithm used to buld classification model.

classifier

trained prediction model obtained from the classifier function.

featureMat

a numeric matrix; feature matrix containing samples to be scored and their feature values.

Value

value

A numeric vector containing the prediction score of each sample.

Author(s)

Chuang Ma, Xiangfeng Wang

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
## Not run: 

   ##generate expression feature matrix
   sampleVec1 <- c(1, 2, 3, 4, 5, 6)
   sampleVec2 <- c(1, 2, 3, 4, 5, 6)
   featureMat <- expFeatureMatrix( 
           expMat1 = ControlExpMat, sampleVec1 = sampleVec1, 
           expMat2 = SaltExpMat, sampleVec2 = sampleVec2, 
           logTransformed = TRUE, base = 2,
           features = c("zscore", "foldchange", "cv", "expression"))

   ##positive samples
   positiveSamples <- as.character(sampleData$KnownSaltGenes)
   ##unlabeled samples
   unlabelSamples <- setdiff( rownames(featureMat), positiveSamples )
   idx <- sample(length(unlabelSamples))
   ##randomly selecting a set of unlabeled samples as negative samples
   negativeSamples <- unlabelSamples[idx[1:length(positiveSamples)]]

   ##for random forest, and using five-fold cross validation 
   ##for obtaining optimal parameters
   cl <- classifier( method = "randomForest", featureMat = featureMat, 
        positiveSamples = positiveSamples, negativeSamples = negativeSamples,
        tunecontrol = tune.control(sampling = "cross", cross = 5), 
        ntree = 100 ) #build 100 trees for the forest


   ##constructed prediction model
   predModel <- cl$best.model

   ##perform prediction
   predResult <- predictor(method = "randomForest", 
                           classifier = predModel, 
                           featureMat = featureMat)


## End(Not run)

mlDNA documentation built on May 2, 2019, 2:15 p.m.