You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Could there be an option to issue a warning and return 0 rather than stopping? Better to have a lower bound on the object size rather than no estimate.
Or could it fall back to object.size() for those elements, again with a warning?
Here is an example:
data(Boston, package="MASS")
library(randomForest)
library(pryr)
set.seed(1)
outcome=Boston$medvdata=Boston[, -14]
# This works ok.rf= randomForest(outcome~., data=data, keep.forest=T)
object_size(rf)
# But not the SuperLearner version.
library(SuperLearner)
sl_rf= SuperLearner(outcome, data, family="gaussian",
SL.library= c("SL.mean", "SL.randomForest"))
# Doesn't work due to the terms element.
object_size(sl_rf)
# object.size() works though.
object.size(sl_rf)
# Dig into the sl_rf details.obj=sl_rf$fitLibrary$SL.randomForest_All$object# Fails on $terms element of type "LANGSXP"for (namein names(obj)) {
elm=obj[[name]]
cat("Element:", name, "Type:", pryr::sexp_type(elm), "Size:")
try(cat(pryr::object_size(elm)))
cat("\n")
}
# Dig into the terms attributesterms=obj$terms# All of these are ok.for (attr_namein names(attributes(terms))) {
elm= attr(obj, attr_name, exact=T)
cat("Attribute:", attr_name, "Type:", pryr::sexp_type(elm), "Size:")
try(cat(pryr::object_size(elm)))
cat("\n")
}
I noticed that DOTSXP is not handled in pryr::object_size
Here is an example:
See https://github.com/hadley/pryr/blob/master/src/object_size.cpp#L149
The text was updated successfully, but these errors were encountered: