Description Usage Arguments Details Value Author(s) Examples
Fits mixtures of normals for every feature, separately for each class.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ## S4 method for signature 'matrix'
mixModelsTrain(measurements, ...)
## S4 method for signature 'DataFrame'
mixModelsTrain(measurements, classes, ..., verbose = 3)
## S4 method for signature 'MultiAssayExperiment'
mixModelsTrain(measurements, targets = names(measurements), ...)
## S4 method for signature 'MixModelsListsSet,matrix'
mixModelsPredict(models, test, ...)
## S4 method for signature 'MixModelsListsSet,DataFrame'
mixModelsPredict(models, test, weighted = c("unweighted", "weighted", "both"),
weight = c("height difference", "crossover distance", "both"),
densityXvalues = 1024, minDifference = 0,
returnType = c("class", "score", "both"), verbose = 3)
## S4 method for signature 'MixModelsListsSet,MultiAssayExperiment'
mixModelsPredict(models, test, targets = names(test), ...)
|
measurements |
Either a |
classes |
Either a vector of class labels of class |
test |
An object of the same class as |
targets |
If |
... |
Variables not used by the |
models |
A |
weighted |
Default: |
weight |
Default: |
densityXvalues |
Default: 1024. Only relevant when |
minDifference |
Default: 0. The minimum difference in sums of mixture densities between the class with the highest sum and the class with the second highest sum for a feature to be allowed to vote. Can be a vector of cutoffs. If no features for a particular sample have a difference large enough, the class predicted is simply the largest class. |
returnType |
Default: |
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 weighted is TRUE, then a sample's predicted class is the class with
the largest sum of weights, each scaled for the number of samples in
the training data of each class. Otherwise, when weighted is FALSE,
each feature has an equal vote, and votes for the class with the largest weight, scaled for
class sizes in the training set.
If weight is "crossover distance", the crossover points are computed by considering the
distance between y values of the two densities at every x value. x values for which the sign of the
difference changes compared to the difference of the closest lower value of x are used as
the crossover points.
For mixModelsTrain, a list of trained models of class MixmodCluster.
For mixModelsPredict, a vector or list of class prediction information (i.e. classes and/or scores),
as long as the number of samples in the test data, or lists of such information, if both
weighted and unweighted voting was used or a range of minDifference values was provided.
Dario Strbenac
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # First 25 samples and first 5 genes are mixtures of two normals. Last 25 samples are
# one normal.
genesMatrix <- sapply(1:25, function(geneColumn) c(rnorm(5, sample(c(5, 15), replace = TRUE, 5))))
genesMatrix <- cbind(genesMatrix, sapply(1:25, function(geneColumn) c(rnorm(5, 9, 1))))
genesMatrix <- rbind(genesMatrix, sapply(1:50, function(geneColumn) rnorm(5, 9, 1)))
rownames(genesMatrix) <- paste("Gene", 1:10)
colnames(genesMatrix) <- paste("Sample", 1:50)
classes <- factor(rep(c("Poor", "Good"), each = 25), levels = c("Good", "Poor"))
trainSamples <- c(1:15, 26:40)
testSamples <- c(16:25, 41:50)
selected <- 1:5
trained <- mixModelsTrain(genesMatrix[selected, trainSamples], classes[trainSamples],
nbCluster = 1:3)
mixModelsPredict(trained, genesMatrix[selected, testSamples], minDifference = 0:3)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.