Description Usage Arguments Value Examples
View source: R/adjacencyMatrixKNN.R
This funtions builds the adjacency matrix (the graph) given a data frame of numerical features.
1 2 | adjacencyMatrixKNN(sequenceFeatures, sequenceLabels = rep(0,
nrow(sequenceFeatures)), nNearestNeighbor = 10, threadNumber = NA)
|
sequenceFeatures |
Data frame with features extracted from stem-loop sequences. |
sequenceLabels |
Vector of labels of the stem-loop sequences. It must have -1 for negative examples, 1 for known miRNAs and zero for the unknown sequences (the ones that would be classificated). |
nNearestNeighbor |
Number of nearest neighbors in the KNN graph. The default value is 10. |
threadNumber |
Number of threads used for the calculations. If it is NA leave OpenMP decide the number (may vary across different platforms). |
Returns the eigen descomposition as a list with two elements: The eigen vectors matrix 'U' and the eigen values vector 'D'.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # First construct the label vector with the CLASS column
y = as.numeric(celegans$CLASS)*2 - 1
# Remove some labels to make a test
y[sample(which(y>0),200)] = 0
y[sample(which(y<0),700)] = 0
# Take all the features but remove the label column
x = subset(celegans, select = -CLASS)
A = adjacencyMatrixKNN(x, y, 10, 8)
for (nev in seq(50,200, 50)) {
# the data frame of features 'x' should not be pass as parameter
p = miRNAss(sequenceLabels = y, AdjMatrix = A,
nEigenVectors = nev)
# Calculate some performance measures
SE = mean(p[ celegans$CLASS & y==0] > 0)
SP = mean(p[!celegans$CLASS & y==0] < 0)
cat("N: ", nev, "\n SE: ", SE, "\n SP: ", SP, "\n")
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.