The progressify package allows you to easily add progress
reporting to sequential and parallel map-reduce code by piping to the
progressify() function. Easy!
library(progressify)
handlers(global = TRUE)
library(partykit)
data("Titanic", package = "datasets")
tt <- as.data.frame(Titanic)
forest <- cforest(Survived ~ ., data = tt, ntree = 50L) |> progressify()
This vignette demonstrates how to use this approach to add progress
reporting to partykit functions such as cforest().
The partykit cforest() function is an implementation of random
forests. For example,
library(partykit)
data("Titanic", package = "datasets")
tt <- as.data.frame(Titanic)
forest <- cforest(Survived ~ ., data = tt, ntree = 50L)
Here cforest() provides no feedback on how far it has progressed,
but we can easily add progress reporting by using:
library(partykit)
library(progressify)
handlers(global = TRUE)
data("Titanic", package = "datasets")
tt <- as.data.frame(Titanic)
forest <- cforest(Survived ~ ., data = tt, ntree = 50L) |> progressify()
Using the default progress handler, the progress reporting will appear as:
|===== | 20%
Similarly, we can report on progress when calculating the variable importance of the trees in the forest:
vi <- varimp(forest) |> progressify()
The progressify() function supports the following partykit
functions:
cforest()varimp() for cforest objectsThe progressify() function cannot yet be combined with futurize()
of the futurize package for partykit functions, because both
work by setting the applyfun argument, which only one of them can
control. With |> progressify() |> futurize(), there is an error.
With |> futurize() |> progressify(), there is progress reporting,
but the processing is sequential.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.