Running examples in 'isotree-Ex.R' failed
The error most likely occurred in:

> ### Name: isolation.forest
> ### Title: Create Isolation Forest Model
> ### Aliases: isolation.forest
> 
> ### ** Examples
> 
> ### Example 1: detect an obvious outlier
> ### (Random data from a standard normal distribution)
> library(isotree)
> set.seed(1)
> m <- 100
> n <- 2
> X <- matrix(rnorm(m * n), nrow = m)
> 
> ### Will now add obvious outlier point (3, 3) to the data
> X <- rbind(X, c(3, 3))
> 
> ### Fit a small isolation forest model
> iso <- isolation.forest(X, ntrees = 10, nthreads = 1)
> 
> ### Check which row has the highest outlier score
> pred <- predict(iso, X)
> cat("Point with highest outlier score: ",
+     X[which.max(pred), ], "\n")
Point with highest outlier score:  3 3 
> 
> 
> ### Example 2: plotting outlier regions
> ### This example shows predicted outlier score in a small
> ### grid, with a model fit to a bi-modal distribution. As can
> ### be seen, the extended model is able to detect high
> ### outlierness outside of both regions, without having false
> ### ghost regions of low-outlierness where there isn't any data
> library(isotree)
> oldpar <- par(mfrow = c(2, 2), mar = c(2.5,2.2,2,2.5))
> 
> ### Randomly-generated data from different distributions
> set.seed(1)
> group1 <- data.frame(x = rnorm(1000, -1, .4),
+     y = rnorm(1000, -1, .2))
> group2 <- data.frame(x = rnorm(1000, +1, .2),
+     y = rnorm(1000, +1, .4))
> X = rbind(group1, group2)
> 
> ### Add an obvious outlier which is within the 1d ranges
> ### (As an interesting test, remove and see what happens,
> ###  or check how its score changes when using sub-sampling)
> X = rbind(X, c(-1, 1))
> 
> ### Produce heatmaps
> pts = seq(-3, 3, .1)
> space_d <- expand.grid(x = pts, y = pts)
> plot.space <- function(Z, ttl) {
+     image(pts, pts, matrix(Z, nrow = length(pts)),
+       col = rev(heat.colors(50)),
+       main = ttl, cex.main = 1.4,
+       xlim = c(-3, 3), ylim = c(-3, 3),
+       xlab = "", ylab = "")
+     par(new = TRUE)
+     plot(X, type = "p", xlim = c(-3, 3), ylim = c(-3, 3),
+      col = "#0000801A",
+      axes = FALSE, main = "",
+      xlab = "", ylab = "")
+ }
> 
> ### Now try ouy different variations of the model
> 
> ### Single-variable model
> iso_simple = isolation.forest(
+     X, ndim=1,
+     ntrees=100,
+     nthreads=1,
+     penalize_range=FALSE,
+     prob_pick_pooled_gain=0,
+     prob_pick_avg_gain=0)
> Z1 <- predict(iso_simple, space_d)
> plot.space(Z1, "Isolation Forest")
> 
> ### Extended model
> iso_ext = isolation.forest(
+      X, ndim=2,
+      ntrees=100,
+      nthreads=1,
+      penalize_range=FALSE,
+      prob_pick_pooled_gain=0,
+      prob_pick_avg_gain=0)
> Z2 <- predict(iso_ext, space_d)
> plot.space(Z2, "Extended Isolation Forest")
> 
> ### SCiForest
> iso_sci = isolation.forest(
+      X, ndim=2,
+      ntrees=100,
+      nthreads=1,
+      penalize_range=TRUE,
+      prob_pick_pooled_gain=0,
+      prob_pick_avg_gain=1)
> Z3 <- predict(iso_sci, space_d)
> plot.space(Z3, "SCiForest")
>      
> ### Fair-cut forest
> iso_fcf = isolation.forest(
+      X, ndim=2,
+      ntrees=100,
+      nthreads=1,
+      penalize_range=FALSE,
+      prob_pick_pooled_gain=1,
+      prob_pick_avg_gain=0)

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc