Skip to content
Permalink
Browse files

Merge 88f1daa into 976c058

  • Loading branch information...
mnwright committed Dec 7, 2018
2 parents 976c058 + 88f1daa commit f783894489b867b20b463e00858a139808ad82d7
Showing with 20 additions and 7 deletions.
  1. +2 −2 DESCRIPTION
  2. +3 −0 NEWS
  3. +3 −0 NEWS.md
  4. +1 −1 R/predict.R
  5. +2 −2 R/ranger.R
  6. +1 −1 cpp_version/src/version.h
  7. +8 −1 tests/testthat/test_ranger.R
@@ -1,8 +1,8 @@
Package: ranger
Type: Package
Title: A Fast Implementation of Random Forests
Version: 0.10.5
Date: 2018-09-13
Version: 0.10.6
Date: 2018-12-07
Author: Marvin N. Wright [aut, cre], Stefan Wager [ctb], Philipp Probst [ctb]
Maintainer: Marvin N. Wright <cran@wrig.de>
Description: A fast implementation of Random Forests, particularly suited for high
3 NEWS
@@ -1,3 +1,6 @@
##### Version 0.10.6
* Bug fixes

##### Version 0.10.5
* Add support of splitting weights for corrected impurity importance
* Bug fixes
@@ -1,3 +1,6 @@
##### Version 0.10.6
* Bug fixes

##### Version 0.10.5
* Add support of splitting weights for corrected impurity importance
* Bug fixes
@@ -268,7 +268,7 @@ predict.ranger.forest <- function(object, data, predict.all = FALSE,
}

## Defaults for variables not needed
dependent.variable.name <- "none"
dependent.variable.name <- ""
mtry <- 0
importance <- 0
min.node.size <- 0
@@ -246,7 +246,7 @@ ranger <- function(formula = NULL, data = NULL, num.trees = 500, mtry = NULL,
stop("Error: Please give formula or dependent variable name.")
}
if (is.null(status.variable.name)) {
status.variable.name <- "none"
status.variable.name <- ""
response <- data[, dependent.variable.name, drop = TRUE]
} else {
response <- survival::Surv(data[, dependent.variable.name], data[, status.variable.name]) #data[, c(dependent.variable.name, status.variable.name)]
@@ -310,7 +310,7 @@ ranger <- function(formula = NULL, data = NULL, num.trees = 500, mtry = NULL,
status.variable.name <- dimnames(response)[[2]][2]
} else {
dependent.variable.name <- names(data.selected)[1]
status.variable.name <- "none"
status.variable.name <- ""
}
independent.variable.names <- names(data.selected)[-1]
} else {
@@ -1,3 +1,3 @@
#ifndef RANGER_VERSION
#define RANGER_VERSION "0.10.5"
#define RANGER_VERSION "0.10.6"
#endif
@@ -330,4 +330,11 @@ test_that("Meaningful predictions with max.depth = 1", {
expect_lte(max(pred), max(iris$Sepal.Length))
})


test_that("Does not crash when variable named 'none'", {
dat <- data.frame(y = rbinom(100, 1, .5),
x = rbinom(100, 1, .5),
none = rbinom(100, 1, .5))
rf <- ranger(data = dat, dependent.variable.name = "y")
expect_equal(rf$forest$independent.variable.names, c("x", "none"))
expect_silent(predict(rf, dat))
})

0 comments on commit f783894

Please sign in to comment.
You can’t perform that action at this time.