aggregate_imp | R Documentation |
'aggregate_imp()' sums the importances present in a matrix or data.frame according to some user-specified grouping criterion.
aggregate_imp(X, lev = NULL, samples = "rows")
X |
Matrix or data.frame containing the importances (in rows or in columns). |
lev |
(optional) The grouping elements. 'lev' should be as long as the dimension (cols or rows) that one wants to aggregate. If this parameter is absent, the colnames (if samples="rows") or rownames will be used to that effect. In that case, it is expected that the col/rownames follow this pattern: "V_Y", and the variables with the same "V" will be summed. (Check the colnames of a typical output of 'dummy_data()' for more info). |
samples |
Samples are in rows or in columns? (Defaults: "rows"). |
X, a matrix or data.frame containing the aggregated importances.
importances <- matrix(rnorm(90),nrow=3,ncol=30)
rownames(importances) <- c("sample1","sample2","sample3")
colnames(importances) <- paste0("Feat",
rep(1:5,times=2*(1:5)), "_", unlist(lapply(2*(1:5),function(x)LETTERS[1:x])))
## The grouping criterion is:
groups <- paste0("Feat",1:5)
aggregate_imp(X=importances,samples="rows",lev=groups)
## We can also use the colnames:
colnames(importances)
aggregate_imp(X=importances,samples="rows")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.