4 Commits 7cef879af8 ... 94d72e7879

Author SHA1 Message Date
  Miron B. Kursa 94d72e7879 Xgboost test operational 1 year ago
  Miron B. Kursa d337e1fa89 Merge branch 'devel' into moreTests 1 year ago
  Miron B. Kursa 6181cb16f1 Merge branch 'issue2' into devel 1 year ago
  Miron B. Kursa dc857ea488 Fixed xgboost importance source for xgboost 71.1 1 year ago
2 changed files with 4 additions and 3 deletions
  1. 2 2
      R/importance.R
  2. 2 1
      tests/testthat/testSources.R

+ 2 - 2
R/importance.R

@@ -201,8 +201,8 @@ getImpXgboost<-function(x,y,nrounds=5,verbose=0,...){
    verbose=verbose
   )
  )->imp
- rep(0,ncol(x))->ans
- ans[as.numeric(imp$Feature)+1]<-imp$Gain
+ setNames(rep(0,ncol(x)),colnames(x))->ans
+ ans[imp$Feature]<-imp$Gain
  ans
 }
 comment(getImpXgboost)<-'xgboost gain importance'

+ 2 - 1
tests/testthat/testSources.R

@@ -31,5 +31,6 @@ for(e in impSources)
 
 test_that("Importance source getImpXgboost works",{
  set.seed(777)
- Boruta(Species~.,data=iris)->ans
+ #Xgboost importance is generally poor, lower expectations
+ expect_silent(Boruta(Species~.,data=iris))
 })