Memory Allocation           package:party           R Documentation

_M_e_m_o_r_y _A_l_l_o_c_a_t_i_o_n

_D_e_s_c_r_i_p_t_i_o_n:

     This function sets up the memory needed for tree growing. It might
     be  convenient to allocate memory only once but build multiple
     trees.

_U_s_a_g_e:

     ctree_memory(object, MPinv = FALSE)

_A_r_g_u_m_e_n_t_s:

  object: an object of class 'LearningSample'.

   MPinv: a logical indicating whether memory for the Moore-Penrose
          inverse of covariance matrices should be allocated. 

_D_e_t_a_i_l_s:

     This function is normally not to be called by users. However, for
     performance reasons it might be nice to allocate memory and re-fit
     trees using the same memory for the computations. Below is an
     example.

_V_a_l_u_e:

     An object of class 'TreeFitMemory'.

_E_x_a_m_p_l_e_s:

         ### setup learning sample
         airq <- subset(airquality, !is.na(Ozone))
         ls <- dpp(conditionalTree, Ozone ~ ., data = airq)

         ### setup memory and controls 
         mem <- ctree_memory(ls)
         ct <- ctree_control(teststat = "max")

         ### fit 50 trees on bootstrap samples
         bs <- rmultinom(50, nrow(airq), rep(1, nrow(airq))/nrow(airq))
         storage.mode(bs) <- "double"
         cfit <- conditionalTree@fit
         system.time(ens <- apply(bs, 2, function(w) cfit(ls, ct, weights = w, 
                                                          fitmem = mem)))

