Last data update: 2014.03.03

R: A grouped variable importance with Random Forests
varImpGroupR Documentation

A grouped variable importance with Random Forests

Description

A permutation variable importance for groups of variables with Random Forests.

Usage

varImpGroup(object, xdata, ngroups = length(nvarGroup), nvarGroup,
            idxGroup, groupsNames = names(nvarGroup), 
            normalize = (length(unique(nvarGroup)) != 1))

Arguments

object

A randomForest object.

xdata

The input data.

ngroups

The number of groups.

nvarGroup

The vector of the number of variables in each group.

idxGroup

A list of size ‘ngroups’ containing the indexes of each group starting from 0.

groupsNames

The group names.

normalize

Should the normalized grouped importance measure be computed.

Value

An object of class ‘importance’ which is a vector of the importance for each group.

Author(s)

Baptiste Gregorutti

References

Gregorutti, B., Michel, B. and Saint Pierre, P. (2015). Grouped variable importance with random forests and application to multiple functional data analysis, Computational Statistics and Data Analysis 90, 15-35.

See Also

selectGroup,selectLevel,selectFunctional,plot.importance

Examples

  data(toyClassif)
  attach(toyClassif)

  rf <- randomForest(x=X,y=Y,keep.forest=TRUE, keep.inbag=TRUE, ntree=500)
  ngroups <- 3
  nvarGroup <- c(4,3,6)
  idxGroup <- list(c(0,1,2,5), c(2,4,5), c(0,1,5,6,7,8))
  grImp <- varImpGroup(rf, X, ngroups, nvarGroup, idxGroup, NULL, normalize=FALSE )
  cat("Group importance\n", grImp, "\n")

  detach(toyClassif)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(RFgroove)
Loading required package: randomForest
randomForest 4.6-12
Type rfNews() to see new features/changes/bug fixes.
Loading required package: wmtsa
Loading required package: fda
Loading required package: splines
Loading required package: Matrix

Attaching package: 'fda'

The following object is masked from 'package:graphics':

    matplot

> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/RFgroove/varImpGroup.Rd_%03d_medium.png", width=480, height=480)
> ### Name: varImpGroup
> ### Title: A grouped variable importance with Random Forests
> ### Aliases: varImpGroup
> 
> ### ** Examples
> 
>   data(toyClassif)
>   attach(toyClassif)
> 
>   rf <- randomForest(x=X,y=Y,keep.forest=TRUE, keep.inbag=TRUE, ntree=500)
>   ngroups <- 3
>   nvarGroup <- c(4,3,6)
>   idxGroup <- list(c(0,1,2,5), c(2,4,5), c(0,1,5,6,7,8))
>   grImp <- varImpGroup(rf, X, ngroups, nvarGroup, idxGroup, NULL, normalize=FALSE )
>   cat("Group importance\n", grImp, "\n")
Group importance
 0.2678949 0.1235128 0.1726564 
> 
>   detach(toyClassif)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>