R/prune.semforest.R

Defines functions prune.semforest

Documented in prune.semforest

#' @exportS3Method prune semforest
prune.semforest <- function(object, max.depth=NULL, num.trees=NULL, ...)
{
  if (!is.null(num.trees)) {
    object$forest <- object$forest[1:num.trees]
    object$forest.data <- object$forest.data[1:num.trees]
  }
  
  if (!is.null(max.depth)) {
    object$forest <- lapply(object$forest, prune.semtree, max.depth=max.depth)
  }
  
  return(object);
  
}

Try the semtree package in your browser

Any scripts or data that you put into this service are public.

semtree documentation built on May 29, 2024, 4:05 a.m.