prepareForSave: Prepares ExtraTrees object for save() function

Description Usage Arguments Value Author(s) Examples

Description

This function prepares ExtraTrees for saving by serializing the trees in Java VM. It is equivalent to calling .jcache(et$jobject). Afterwards the object can be saved by save (or automatic R session saving) and will be fully recovered after load.

Note: the object can still be used as usual after prepareForSave.

Usage

1
  prepareForSave(object)

Arguments

object

extraTrees (S3) object, created by extraTrees().

Value

Nothing is returned.

Author(s)

Jaak Simm

Examples

1
2
3
4
5
6
7
8
9
  et <- extraTrees(iris[,1:4], iris$Species)
  prepareForSave(et)
  ## saving to a file
  save(et, file="temp.Rdata")

  ## testing: remove et and load it back from file
  rm(list = "et")
  load("temp.Rdata")
  predict(et, iris[,1:4])

Example output

Loading required package: rJava
OpenJDK 64-Bit Server VM warning: Can't detect primordial thread stack location - find_vma failed
  [1] setosa     setosa     setosa     setosa     setosa     setosa    
  [7] setosa     setosa     setosa     setosa     setosa     setosa    
 [13] setosa     setosa     setosa     setosa     setosa     setosa    
 [19] setosa     setosa     setosa     setosa     setosa     setosa    
 [25] setosa     setosa     setosa     setosa     setosa     setosa    
 [31] setosa     setosa     setosa     setosa     setosa     setosa    
 [37] setosa     setosa     setosa     setosa     setosa     setosa    
 [43] setosa     setosa     setosa     setosa     setosa     setosa    
 [49] setosa     setosa     versicolor versicolor versicolor versicolor
 [55] versicolor versicolor versicolor versicolor versicolor versicolor
 [61] versicolor versicolor versicolor versicolor versicolor versicolor
 [67] versicolor versicolor versicolor versicolor versicolor versicolor
 [73] versicolor versicolor versicolor versicolor versicolor versicolor
 [79] versicolor versicolor versicolor versicolor versicolor versicolor
 [85] versicolor versicolor versicolor versicolor versicolor versicolor
 [91] versicolor versicolor versicolor versicolor versicolor versicolor
 [97] versicolor versicolor versicolor versicolor virginica  virginica 
[103] virginica  virginica  virginica  virginica  virginica  virginica 
[109] virginica  virginica  virginica  virginica  virginica  virginica 
[115] virginica  virginica  virginica  virginica  virginica  virginica 
[121] virginica  virginica  virginica  virginica  virginica  virginica 
[127] virginica  virginica  virginica  virginica  virginica  virginica 
[133] virginica  virginica  virginica  virginica  virginica  virginica 
[139] virginica  virginica  virginica  virginica  virginica  virginica 
[145] virginica  virginica  virginica  virginica  virginica  virginica 
Levels: setosa versicolor virginica

extraTrees documentation built on May 2, 2019, 2:31 p.m.