Feature selection is the data mining process of selecting the variables from our data set that may have an impact on the outcome we are considering. For commercial data mining, which is often characterised by having too many variables for model building, this is an important step in the analysis process. And since we often work on very large data sets the performance of our process is very important to us.

Having looked at feature selection using the Boruta package and feature selection using the caret package separately, we now consider the performance of the two approaches.

For our tests we will use an artificially constructed trivial data sets that the automated process should have no problems with (but we will be disappointed later on this expectation, as we will see). The data set has an equal number of normal and uniform random variables with mean 0 and variance 1 of which 20% are used for the target variable. There are 10 time as many observations as variables. We create a function to set this up:

## The Boruta package

Then we run a test using the Boruta package for different sizes:

As it turned out, our expectations for the size of data set we could handle were wildly optimistic and we killed the process at size 30. We add to the data set a field with the total number of variables in the x data set and plot the results.

A quick check using `summary(lm(log(elapsed) ~ log(n.elem), data = bench))`

shows us a linear scaling with the number of elements (slope is 1.01 with standard error 0.025 and adjusted R² 0.993). The algorithm selects all the right features up to `n.vars = 10`

when it starts to miss some of them:

n.vars | right | wrong |
---|---|---|

1 | 2.00000 | 1.1000000 |

2 | 4.00000 | 1.2000000 |

3 | 6.00000 | 1.6666667 |

4 | 8.00000 | 1.3333333 |

5 | 10.00000 | 1.6666667 |

6 | 12.00000 | 1.3333333 |

7 | 14.00000 | 1.0000000 |

8 | 16.00000 | 1.3333333 |

9 | 18.00000 | 0.6666667 |

10 | 20.00000 | 0.3333333 |

20 | 39.33333 | 0.0000000 |

30 | 56.33333 | 0.0000000 |

A higher accuracy in the feature selection for the larger problems could presumably be achieved by adjusting the `maxRuns`

and perhaps confidence parameters on the `Boruta`

call.

In summary, the Boruta package performs well up to about 20 features out of 100 (`n.vars = 10`

) which runs in about 11 minutes on my machine. If we changed the technical implementation to support multicore, MPI, and other parallel frameworks, then the out of the box settings would be useful up to `n.vars`

of 20 or 30 (40-60 features out of 200-300) which an 8-core machine should be able to complete in 20 minutes or so.

This is still a lot less than the size of data sets we normally work with. (Our usual benchmark is 15,000 variables and 50,000 observations.)

## The caret package

One of the nice features of the caret package is that is supports most parallel processing frameworks out of the box, but for comparison with the previous analysis we will (somewhat unfairly) not use that here. The setup is then quite simple, using the same make.data function as before.

This uses the `randomForest`

classifier from the package of the same name. To use the ipredbagg bagging classifier from Andrea Peters and Torsten Hothorn’s ipred: Improved Predictors package we simply change the control object to:

As usual, we were widely optimistic in our guesses for the size of problems we could handle, and had to abort the run.

n.vars | right | wrong |
---|---|---|

2 | 3.20000 | 3.200000 |

3 | 5.00000 | 0.000000 |

4 | 7.00000 | 0.000000 |

5 | 9.00000 | 0.000000 |

6 | 11.00000 | 0.000000 |

7 | 13.00000 | 0.000000 |

8 | 14.66667 | 0.000000 |

9 | 16.66667 | 0.000000 |

10 | 19.00000 | 0.000000 |

20 | 38.66667 | 1.333333 |

30 | 54.00000 | 86.000000 |

n.vars | right | wrong |
---|---|---|

2 | 3.00000 | 0 |

3 | 5.00000 | 0 |

4 | 7.00000 | 0 |

5 | 9.00000 | 0 |

6 | 10.33333 | 0 |

7 | 13.00000 | 0 |

8 | 14.33333 | 0 |

9 | 16.00000 | 0 |

10 | 18.66667 | 0 |

20 | 35.33333 | 0 |

30 | 54.33333 | 0 |

40 | 69.66667 | 0 |

Remember that the right number of significant features are `2 * n.vars`

and we see that the caret package apparently always miss one feature in its selection, which is very odd and possibly a bug. It is less likely to select the wrong features than Boruta, but that could be partially due to “Tentative” data in Boruta. Timing-wise, performance is a little worse in the non-parallel situation but realistically of course a lot better than Boruta depending on the number of cores on your processor or nodes in your cluster.

Neither approach is suitable out of the box for the sizes of data sets that we normally work with.