Last chance! 50% off unlimited learning
Sale ends in
Plots marginal relevance scores for features of a given data matrix. The default plot shows: the marginal relevance score (MR score) of each feature. The "pairs" and "parallelcoord" show scatterplot matrix and the parallel coordinates plot of features ordered by their MR score.
# S3 method for marginalRelevance
plot(x, newdata = NULL, n.feat = NULL, type = "default", ...)
a marginalRelevance
object.
a matrix containing the new input data.
the number of features with highest MR score to plot. Default is all features.
"parallelcoord", "pairs" or default.
options directly passed to the plot function.
If newdata
is omitted the predictions are based on the data used for deriving the MR score.
# NOT RUN {
data(microarray)
profiles <- as.matrix(microarray[, -2309])
tumourType <- microarray[, 2309]
margRelv <- marginalRelevance(profiles, tumourType)
# plot 30 gene profiles with highest marginal relevance score
plot(margRelv, type = "parallelcoord", n.feat = 50, col = tumourType )
# }
# NOT RUN {
library(kernlab)
data(spam)
test <- sample(1:4601,2000)
dt <- as.matrix(spam[-test ,-58])
labels <- spam[-test , 58]
margRelv <- marginalRelevance(dt, labels)
#plot MR scores
plot(margRelv)
plot(margRelv , col = labels, type = "pairs", n.feat = 5)
plot(margRelv , col = labels, type = "parallelcoord", n.feat = 30)
# test set
plot(margRelv , as.matrix(spam[test ,-58]), col = spam[test , 58],
type = "pairs", n.feat = 5)
plot(margRelv , as.matrix(spam[test ,-58]), col = spam[test , 58],
type = "parallelcoord", n.feat = 30)
# }
Run the code above in your browser using DataLab