Skip to content

Commit

Permalink
try dropping cars
Browse files Browse the repository at this point in the history
  • Loading branch information
bcjaeger committed Nov 17, 2023
1 parent 0ee97c4 commit 65b63d0
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 8 deletions.
24 changes: 22 additions & 2 deletions R/orsf_R6.R
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,24 @@ ObliqueForest <- R6::R6Class(
na_action,
verbose_progress) {

# if these arguments were specified in the initial
# call or in updates, then they should be checked.
# Note the arguments in this list are NULL in orsf()
# by default, which means their defaults are dynamic.
# other arguments with non-dynamic defaults should
# always be checked if a user wants to use update().

private$user_specified <- list(
control = !is.null(control),
weights = !is.null(weights),
mtry = !is.null(mtry),
split_rule = !is.null(split_rule),
split_min_stat = !is.null(split_min_stat),
pred_type = !is.null(pred_type),
pred_horizon = !is.null(oobag_pred_horizon),
tree_seeds = !is.null(tree_seeds)
)

self$data <- data
self$formula <- formula
self$control <- control
Expand Down Expand Up @@ -129,7 +147,6 @@ ObliqueForest <- R6::R6Class(

},

# initialization
update = function(data = NULL,
formula = NULL,
control = NULL,
Expand Down Expand Up @@ -1061,6 +1078,7 @@ ObliqueForest <- R6::R6Class(

private = list( # private ----

user_specified = NULL,
data_rows_complete = NULL,
data_types = NULL,
data_names = NULL,
Expand Down Expand Up @@ -1304,7 +1322,9 @@ ObliqueForest <- R6::R6Class(

if(is.null(self$oobag_eval_function)){

self$oobag_eval_function <- function(x) x
self$oobag_eval_function <- function(y_mat, w_vec, s_vec){
return(1)
}

} else {

Expand Down
10 changes: 4 additions & 6 deletions vignettes/aorsf.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,16 @@ penguin_fit
```

and for regression, we use the `mtcars` data:
and for regression, we again use the penguins data but switch the outcome:

```{r}
data("mtcars")
# An oblique regression RF
cars_fit <- orsf(data = mtcars,
bill_fit <- orsf(data = penguins_orsf,
n_tree = 5,
formula = mpg ~ .)
formula = bill_length_mm ~ .)
cars_fit
bill_fit
```

Expand Down

0 comments on commit 65b63d0

Please sign in to comment.