| DLDAinterface {ClassifyR} | R Documentation |
DLDAtrainInterface generates a trained diagonal LDA classifier and DLDApredictInterface
uses it to make predictions on a test data set.
## S4 method for signature 'matrix' DLDAtrainInterface(measurements, classes, ...) ## S4 method for signature 'DataFrame' DLDAtrainInterface(measurements, classes, verbose = 3) ## S4 method for signature 'MultiAssayExperiment' DLDAtrainInterface(measurements, targets = names(measurements), ...) ## S4 method for signature 'dlda,matrix' DLDApredictInterface(model, test, ...) ## S4 method for signature 'dlda,DataFrame' DLDApredictInterface(model, test, verbose = 3) ## S4 method for signature 'dlda,MultiAssayExperiment' DLDApredictInterface(model, test, targets = names(test), ...)
measurements |
Either a |
classes |
Either a vector of class labels of class |
model |
A fitted model as returned by |
test |
An object of the same class as |
targets |
If |
... |
Variables not used by the |
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. |
If measurements is an object of class MultiAssayExperiment, the factor of
sample classes must be stored in the DataFrame accessible by the colData function
with column name "class".
For DLDAtrainInterface, a trained DLDA classifier.
For DLDApredictInterface, a result of type list with elements class,
scores and posterior, as created by sparsediscrim's predict method.
Dario Strbenac
# if(require(sparsediscrim)) Package currently removed from CRAN.
#{
# 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))))
classes <- factor(rep(c("Poor", "Good"), each = 25))
colnames(genesMatrix) <- paste("Sample", 1:ncol(genesMatrix))
rownames(genesMatrix) <- paste("Gene", 1:nrow(genesMatrix))
selected <- rownames(genesMatrix)[91:100]
trainingSamples <- c(1:20, 26:45)
testingSamples <- c(21:25, 46:50)
classifier <- DLDAtrainInterface(genesMatrix[selected, trainingSamples],
classes[trainingSamples])
DLDApredictInterface(classifier, genesMatrix[selected, testingSamples])[["class"]]
#}