previousTrained: Automated Usage of Previously Created Classifiers

Description Usage Arguments Value Author(s) Examples

Description

Uses the trained classifier of the same cross-validation iteration of a previous classification for the current classification task.

Usage

1
2
  ## S4 method for signature 'ClassifyResult'
previousTrained(classifyResult, .iteration, verbose = 3)

Arguments

classifyResult

A ClassifyResult object which stores the models fitted previously.

.iteration

Do not specify this variable. It is set by runTests if this function is being repeatedly called by runTests.

verbose

Default: 3. A number between 0 and 3 for the amount of progress messages to give. This function only prints progress messages if the value is 3.

Value

A trained classifier from a previously completed classification task.

Author(s)

Dario Strbenac

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
38
39
  #if(require(sparsediscrim))
  #{
    # Genes 76 to 100 have differential expression.
    genesMatrix <- sapply(1:25, function(sample) c(rnorm(100, 9, 2)))
    genesMatrix <- cbind(genesMatrix, sapply(1:25, function(sample)
                                 c(rnorm(75, 9, 2), rnorm(25, 14, 2))))
    colnames(genesMatrix) <- paste("Sample", 1:50)
    rownames(genesMatrix) <- paste("Gene", 1:100)                                 
    classes <- factor(rep(c("Poor", "Good"), each = 25))
    resubstitute <- ResubstituteParams(nFeatures = seq(10, 100, 10), 
                        performanceType = "error", better = "lower")
    result <- runTests(genesMatrix, classes, datasetName = "Example",
                       classificationName = "Differential Expression",
                       permutations = 2, fold = 2,
                       params = list(SelectParams(), TrainParams(), PredictParams()))
    models(result)
                       
    # Genes 50 to 74 have differential expression in new data set.
    newDataset <- sapply(1:25, function(sample) c(rnorm(100, 9, 2)))
    newDataset <- cbind(newDataset, rbind(sapply(1:25, function(sample) rnorm(49, 9, 2)),
                                          sapply(1:25, function(sample) rnorm(25, 14, 2)),
                                          sapply(1:25, function(sample) rnorm(26, 9, 2))))
                                          
    rownames(newDataset) <- rownames(genesMatrix)
    colnames(newDataset) <- colnames(genesMatrix)
                                           
    newerResult <- runTests(newDataset, classes, datasetName = "Latest Data Set",
                            classificationName = "Differential Expression",
                            permutations = 2, fold = 2,
                            params = list(SelectParams(previousSelection,
                                                       intermediate = ".iteration",
                                                       classifyResult = result),
                                          TrainParams(previousTrained,
                                                      intermediate = ".iteration",
                                                      classifyResult = result),
                                          PredictParams()))
                                     
    models(newerResult)
  #}  

ClassifyR documentation built on Nov. 8, 2020, 6:53 p.m.