isotree.is.same | R Documentation |
Checks if two isolation forest models, as produced by functions like isolation.forest, have a reference to the same underlying C++ object.
When this is the case, functions that produce in-place modifications, such as isotree.build.indexer, will produce changes in all of the R variables that share the same C++ object.
Two R variables will have the same C++ object when assigning one variable to another, but will have different C++ objects when these R objects are serialized and deserialized or when calling isotree.deep.copy.
isotree.is.same(obj1, obj2)
obj1 |
First model to compare (against 'obj2'). |
obj2 |
Second model to compare (against 'obj1'). |
A logical (boolean) value which will be 'TRUE' when both models have a reference to the same C++ object, or 'FALSE' otherwise.
isotree.deep.copy
library(isotree)
data(mtcars)
model <- isolation.forest(mtcars, ntrees = 10, nthreads = 1, ndim = 1)
model_shallow_copy <- model
isotree.is.same(model, model_shallow_copy)
model_deep_copy <- isotree.deep.copy(model)
isotree.is.same(model, model_deep_copy)
isotree.add.tree(model_shallow_copy, mtcars)
length(isotree.get.num.nodes(model_shallow_copy)$total)
length(isotree.get.num.nodes(model)$total)
length(isotree.get.num.nodes(model_deep_copy)$total)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.