Skip to content

Commit 019e6d4

Browse files
committed
Update NEWS, add data.table imports
1 parent b0ebaae commit 019e6d4

File tree

6 files changed

+28
-2
lines changed

6 files changed

+28
-2
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: randomPlantedForest
22
Title: Random Planted Forest: A Directly Interpretable Tree Ensemble
3-
Version: 0.2.1
3+
Version: 0.2.1.9000
44
Authors@R: c(
55
person(c("Joseph", "Theo"), "Meyer", role = "aut"),
66
person("Munir", "Hiabu", role = "aut"),

NAMESPACE

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,17 @@ export(rpf)
1818
import(checkmate)
1919
importFrom(Rcpp,loadModule)
2020
importFrom(Rcpp,sourceCpp)
21+
importFrom(data.table,":=")
2122
importFrom(data.table,':=')
23+
importFrom(data.table,.BY)
24+
importFrom(data.table,.EACHI)
25+
importFrom(data.table,.GRP)
26+
importFrom(data.table,.I)
27+
importFrom(data.table,.N)
28+
importFrom(data.table,.NGRP)
2229
importFrom(data.table,.SD)
2330
importFrom(data.table,as.data.table)
31+
importFrom(data.table,data.table)
2432
importFrom(hardhat,default_formula_blueprint)
2533
importFrom(hardhat,default_recipe_blueprint)
2634
importFrom(hardhat,default_xy_blueprint)

NEWS.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# randomPlantedForest 0.2.1.9000 (Development version)
2+
3+
* Add `remainder` term to `predict_components` output for case where `max_interaction` supplied is smaller than `max_interaction` in `rpf` fit.
4+
In that case, the `m` values don't sum up to the global predictions, so we add a remainder to allow reconstruction of that property.
5+
16
# randomPlantedForest 0.2.1
27

38
* Add `glex` class to output of `predict_components()`, for extended functionality available with [`glex`](https://github.com/PlantedML/glex).

R/predict_components.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ predict_components <- function(object, new_data, max_interaction = NULL, predict
131131
# to make m's sum up to SHAPs etc, see https://github.com/PlantedML/glex/issues/11
132132

133133
if (max_interaction < object$params$max_interaction) {
134-
pred <- predict(object, new_data = new_data, type = "numeric")
134+
pred <- predict.rpf(object, new_data = new_data, type = "numeric")
135135

136136
# handling differs if multiclass
137137
if (length(outcome_levels) > 2) {

R/randomPlantedForest-package.R

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@
33

44
## usethis namespace: start
55
#' @import checkmate
6+
#' @importFrom data.table :=
7+
#' @importFrom data.table .BY
8+
#' @importFrom data.table .EACHI
9+
#' @importFrom data.table .GRP
10+
#' @importFrom data.table .I
11+
#' @importFrom data.table .N
12+
#' @importFrom data.table .NGRP
13+
#' @importFrom data.table .SD
14+
#' @importFrom data.table data.table
615
#' @importFrom Rcpp loadModule
716
#' @importFrom Rcpp sourceCpp
817
#' @useDynLib randomPlantedForest, .registration = TRUE

R/utils.R

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,10 @@ softmax <- function(x) {
214214
#' @param pred Regular model predictions as returned by `predict.rpf`.
215215
#' @param intercept Intercept as stored in output of `predict_components`.
216216
calc_remainders_multiclass <- function(m, levels, pred, intercept) {
217+
218+
# data.table NSE warnings
219+
term <- remainder <- m_sum <- NULL
220+
217221
m <- data.table::as.data.table(m)
218222
pred <- data.table::as.data.table(pred)
219223
intercept <- data.table::as.data.table(intercept)

0 commit comments

Comments
 (0)