SDModels 2.1.0
Bug fixes
- SDForest no longer discards a tree when the estimation of the tree
emits a warning. Before, the fit stopped with “Tree is empty or not
constructed properly”. Warnings from the trees are now reported once per
distinct message, together with the number of trees that raised it.
- The spectral transformation ignores covariates that are constant in
the sample. Before, get_Q() stopped with “svd did not converge” and
SDForest() failed with indicator columns and small max_size. Such
covariates stay in the model, so a forest fitted where a covariate is
constant can be merged with one where it varies.
- SDAM stores one breakpoint entry per covariate, so predict(),
predict_individual_fj() and varImp() work when the last covariates are
modelled linearly.
- SDAM() accepts covariates that are constant in the data. They get no
basis function and a zero coefficient, and they stay in the model.
- The dimension check on a function supplied as Qf was inverted and
rejected every valid transformation. SDTree() now accepts one.
- mergeForest() weighted the predictions of the first forest by the
size of the merged forest.
- mergeForest() returns NA and not NaN for observations without an
out-of-bag tree.
- Predictions apply a split as it was fitted. An observation whose
value equals the split point belongs to the left child, as in the fit
and in the plot of a tree. Before, predict() and the stored predictions
sent it to the right child. A split on a binary covariate usually has
its point at 0, so all observations got the prediction of the group with
1. With continuous covariates only the in-sample predictions of a forest
change, for observations that occur more than once in the bootstrap
sample of a tree.
- SDForest() and SDAM() restore the kind of the random number
generator if they stop with an error.
- envs and leave_out_ind can be used together.
- leave_out_ind may contain the last observation.
- mergeForest() merges the out-of-environment predictions and losses
of two forests on the same data. The forests can have trees for
different environments, and one can leave environments out while the
other is trained on single environments. If only one forest has
environments, the fields are removed with a warning. Before, these
fields described the first forest only.
- mergeForest() no longer stops for forests that were fitted with
return_data = FALSE.
- The anchor transformation in get_W() and in the models only uses the
column space of the anchor A. Before, an anchor that was rank deficient,
in the data or in the bootstrap sample of a tree, made the
transformation scale directions that do not belong to the anchor. This
happened for example with dummy coded anchors together with
nTree_leave_out or nTree_env. An anchor with more columns than rows is
now accepted. Before, get_W() and the models stopped with “A must have
full rank!”, also when only the sample of a tree was smaller than the
number of anchor columns.
- The starting loss of a tree is now the loss of its first fit.
Before, it was too large when the transformation changed the constant
vector, as the anchor transformation does on data that is not centred.
Trees fitted with an anchor and a cp above zero can get larger, and the
variable importance of anchor fits can change. Fits without an anchor do
not change.
- SDTree(), cvSDTree() and SDForest() stop with a message if the
transformation maps a constant vector to zero. This happens with gamma =
0 and an anchor whose column space contains the constant, for example
the dummies of all groups. Before, SDTree() and cvSDTree() returned a
tree with a single leaf and an arbitrary value, with the warning
‘singulaer matrix QE, tree might be to large’.
- With an anchor and predictors, SDTree() and SDForest() estimate the
spectral transformation from all covariates, as the documentation of
predictors says and as the fits without an anchor do. Before, it was
estimated from the predictors only. Such fits change for Q_type = “trim”
and “pca”.
- With an anchor, a warning of the spectral transformation is given
once, when the transformation is estimated. Before, it was repeated with
every use of the transformation, also in prune() and regPath().
- prune() updates the out-of-environment predictions and losses of a
forest with environments. Before, they kept the values of the unpruned
forest. regPath() reports these losses in two more columns of
loss_path.
- get_Q() returns the matrix of the transformation that the models
use. For the trim transformation with an even number of singular values
the result differs slightly from 2.0.2. Model fits are unchanged.
- A trim transformation that shrinks no singular value, for example
with two covariates and trim_quantile = 0.5, now gives a warning.
- With Q_type = “pca”, q_hat is limited to the rank of the covariates
minus one, which is p - 1 with more observations than covariates. A
larger value is reduced with a warning. Before, it removed arbitrary
directions or stopped with “subscript out of bounds”.
- With Q_type = “trim”, the trim index is limited to the rank of the
covariates, with a warning. Before, a small trim_quantile with more
covariates than observations removed the whole response.
- future (>= 1.40.0) is required.
New features
- regPath() returns cp_min_all, the complexity parameter with the
lowest loss for every loss of the path. cp_min is unchanged.
- plot() of a path, plotOOB() and plot() of an SDForest have the
argument loss. With loss = “ooEnv” they use the out-of-environment loss
of a forest with environments.
- print() of an SDForest with environments shows the
out-of-environment losses.
- plot() of a path and plotOOB() end the cp axis where the first
variable enters the model. Before, the axis always went up to 1.
- predictOOEnv() gives the out-of-environment predictions of a forest
with environments, from the trees that were not trained on the
environment of an observation. With the argument envs it predicts new
observations, given as a matrix or as a data frame as in predict().
- SDForest() accepts envs without nTree_leave_out and nTree_env, also
with a single environment. The trees are then fitted as without
environments and the forest stores the environments of its data.
- mergeForest() merges forests with environments that were fitted on
different data, for example one forest per environment. The merged
forest has the data of both and out-of-bag and out-of-environment
predictions and losses for all observations, as a forest fitted on all
data with nTree_env. The observations of the two forests are taken as
distinct.
- mergeForest() merges forests that were fitted with different
spectral transformations. The merged forest has the transformation of
the first forest, for forests on different data estimated on the joined
data with the arguments of the first forest, and a warning says so.
Before, two such forests on the same data were merged in the trees and
the variable importance only.
- A merged forest with environments has the field env_seen, a logical
matrix that says which environments each tree was trained on.
- SDForest objects have the field args_Q with the arguments of the
spectral transformation, which mergeForest() uses for the joined data. A
forest fitted with an anchor also stores A and gamma.
- Forests fitted with SDModels 2.0.2 keep working in predictOOB(),
prune(), regPath(), plot() and mergeForest().
- SDAM models fitted with SDModels 2.0.2 that have linear covariates
in the last positions now work in predict(), predict_individual_fj() and
varImp().
- The out-of-bag computations in SDForest(), predictOOB(), prune(),
regPath() and plot() are vectorised and linear in the number of
observations. A fit with 20,000 observations, 20 trees and max_size =
200 went from 152 to 2 seconds.
- With an anchor, the spectral transformation is estimated once per
tree and once for the forest. Before, it was estimated again with every
use, which is once per covariate in every split search. A forest with an
anchor and Q_type = “trim” on 300 observations and 60 covariates went
from 97 to 17 seconds. Fits with Q_type = “no_deconfounding” take the
same time.
- A forest fitted with an anchor is saved without the internal objects
of the SDForest() call, which the stored transformation carried before.
A saved forest with 50 trees on 586 observations went from 5.2 to 1.7
MB.
Documentation
- The reference for SDForest() is the published article, Ulmer,
Scheidegger, and Bühlmann (2026), Journal of Computational and Graphical
Statistics 35(2), 758-768. citation(“SDModels”) no longer names the
arXiv preprint.
Breaking
- SDForest objects store the logical matrix in_bag in place of the
list oob_ind. ooEnv_ind is no longer returned.
- SDForest() and cvSDTree() no longer have the argument Qf. The
inverted check rejected every valid function, and a function that works
on the sample of every tree or fold can only reproduce Q_type =
“no_deconfounding”. SDTree() keeps the argument.
- plot() of an SDForest no longer has the argument verbose.
- The warning ‘singulaer matrix QE, tree might be to large’ is now
spelled ‘singular matrix QE, tree might be too large’.
SDModels 2.0.2
- Switch all the parallelization to futures. See
vignette("Runtime")
- Switch all the progress updates to progressr. Progress updates are
now also available for parallel processing and are customizable.
- Process are much more RAM efficient now.
SDModels 2.0.1
- Fix bug in SDTree and SDForest where an error occurred, if X had
columns with only one unique value.
SDModels 2.0.0
- Removal of data.tree dependence. Trees are now saved as a
matrix.
- This results in a substantial reduction of RAM usage and space
needed to save an SDTree or SDForest. It also results in increased
computational speed.
- Removal of copy, fromList, and toList. Remove the copy arguments
from all pruning involving functions.
- New plotting of SDTree objects.
- Improved/Robust parallelization.
- Remove gpu support and dependence on GPUmatrix due to it being
scheduled for archiving.
SDModels 1.0.13
- In case of parallel processing use random number generator
“L’Ecuyer-CMRG” for reproducibility
SDModels 1.0.12
- Fix extended SDAM example
SDModels 1.0.11
- Add option to plot SDForests. The plot shows the out-of-bag
performance against the number of trees. This helps to evaluate whether
enough trees were used.
SDModels 1.0.10
- Added feature to select some predictors not to be regularized closes
option to use some covariates not regularized in SDAM #4
- Fix the length of the coefficient list to the number of predictors
and name the elements
- change predict_individual_j to expect a numeric new data vector
instead of a whole data.frame
SDModels 1.0.9
- Add the option to select some variables as predictors in SDTree and
SDForest.
SDModels 1.0.8
- Fix various bugs on edge cases with just one variable or just one
tree
- SDForest, regPath.SDTree, regPath.SDForest, predict.SDForest,
prune.SDForest, varImp.SDTree
SDModels 1.0.7
- Fix bug in estimation of SDTree when using only one covariate (did
stop splitting after one split)
- Add support to predict with an SDForest using multiple cores in
parallel
SDModels 1.0.6
- Fix bug in SDTree.predict(), when predicting using only one
covariate
SDModels 1.0.5
- Fix bug in plot of paths using plotly (remove expression Pi in case
of plotly)
SDModels 1.0.4