diff options
author | davor <vorgrimmlerdavid@gmx.de> | 2012-02-23 17:14:00 +0100 |
---|---|---|
committer | davor <vorgrimmlerdavid@gmx.de> | 2012-02-23 17:14:00 +0100 |
commit | 8a18ae8989eece6d3c6efd92ef298b9e8e7babe4 (patch) | |
tree | 43fd638a05e9b5a459eda40e0e8c308958eb3131 | |
parent | 44780f8305e3a4fbaa0c06ce73af50e95105a813 (diff) |
Removing features with only NA values in rfe.
-rw-r--r-- | lib/algorithm.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/algorithm.rb b/lib/algorithm.rb index db21c46..fb14482 100644 --- a/lib/algorithm.rb +++ b/lib/algorithm.rb @@ -476,6 +476,14 @@ module OpenTox # assumes a data matrix 'features' and a vector 'y' of target values row.names(features)=NULL + # features with all values missing removed + na_col = names ( which ( apply ( features, 2, function(x) all ( is.na ( x ) ) ) ) ) + features = features[,!names(features) %in% na_col] + + # features with zero variance removed + zero_var = names ( which ( apply ( features, 2, function(x) var(x, na.rm=T) ) == 0 ) ) + features = features[,!names(features) %in% zero_var] + pp = NULL if (del_missing) { # needed if rows should be removed |