
Last chance! 50% off unlimited learning
Sale ends in
This funtions builds the adjacency matrix (the graph) given a data frame of numerical features.
adjacencyMatrixKNN(sequenceFeatures, sequenceLabels = rep(0,
nrow(sequenceFeatures)), nNearestNeighbor = 10, threadNumber = NA)
Data frame with features extracted from stem-loop sequences.
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).
Number of nearest neighbors in the KNN graph. The default value is 10.
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'.
# NOT RUN {
# 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")
}
# }
Run the code above in your browser using DataLab