Description Usage Arguments Details Value Author(s) See Also Examples
Each pair of features votes for a class based on whether the value of one feature is less than the other feature.
1 2 3 4 5 6 7 8 9 | ## S4 method for signature 'matrix'
kTSPclassifier(measurements, classes, test, featurePairs = NULL, ...)
## S4 method for signature 'DataFrame'
kTSPclassifier(measurements, classes, test, featurePairs = NULL,
weighted = c("unweighted", "weighted", "both"),
minDifference = 0, returnType = c("class", "score", "both"), verbose = 3)
## S4 method for signature 'MultiAssayExperiment'
kTSPclassifier(measurements, test, target = names(measurements)[1],
featurePairs = NULL, ...)
|
measurements |
Either a |
classes |
Either a vector of class labels of class |
test |
An object of the same class as |
featurePairs |
An object of class as |
target |
If |
... |
Unused variables by the methods for a |
weighted |
Default: |
minDifference |
Default: 0. The minimum difference in densities 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 based on the sum of differences of
measurements for each feature pair. Otherwise, when weighted
is FALSE
, each pair of features
has an equal vote, the predicted class is the one with the most votes. If the voting is tied, the the class
with the most samples in the training set is voted for.
Because this method compares different features, they need to have comparable measurements. For example, RNA-seq counts would be unsuitable since these depend on the length of a feature, whereas F.P.K.M. values would be suitable.
The featurePairs
to use is recommended to be determined in conjunction with pairsDifferencesSelection
.
A vector or list of class prediction information, as long as the number of samples in the test data, or lists of such information, if a variety of predictions is generated.
Dario Strbenac
pairsDifferencesSelection
for a function which could be used to do feature selection before
the k-TSP classifier is run.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # Difference in differences for features A and C between classes.
measurements <- matrix(c(9.9, 10.5, 10.1, 10.9, 11.0, 6.6, 7.7, 7.0, 8.1, 6.5,
8.5, 10.5, 12.5, 10.5, 9.5, 8.5, 10.5, 12.5, 10.5, 9.5,
6.6, 7.7, 7.0, 8.1, 6.5, 11.2, 11.0, 11.1, 11.4, 12.0,
8.1, 10.6, 7.4, 7.1, 10.4, 6.1, 7.3, 2.7, 11.0, 9.1,
round(rnorm(60, 8, 1), 1)), ncol = 10, byrow = TRUE)
classes <- factor(rep(c("Good", "Poor"), each = 5))
rownames(measurements) <- LETTERS[1:10]
colnames(measurements) <- names(classes) <- paste("Patient", 1:10)
trainIndex <- c(1:4, 6:9)
trainMatrix <- measurements[, trainIndex]
testMatrix <- measurements[, c(5, 10)]
featurePairs <- Pairs('A', 'C') # Could be selected by pairsDifferencesSelection function.
kTSPclassifier(trainMatrix, classes[trainIndex], testMatrix, featurePairs)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.