previousTrained {ClassifyR} | R Documentation |
Uses the trained classifier of the same cross-validation iteration of a previous classification for the current classification task.
## S4 method for signature 'ClassifyResult' previousTrained(classifyResult, .iteration, verbose = 3)
classifyResult |
A |
.iteration |
Do not specify this variable. It is set by |
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. |
A trained classifier from a previously completed classification task.
Dario Strbenac
#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())) # 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) #}