Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example with random forest segfaults in R #3052

Closed
david-cortes opened this issue Sep 9, 2021 · 1 comment
Closed

Example with random forest segfaults in R #3052

david-cortes opened this issue Sep 9, 2021 · 1 comment

Comments

@david-cortes
Copy link

david-cortes commented Sep 9, 2021

Trying the Python example from the user guide in R leads to a segmentation fault. Here's a short reproducer with random data:

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)
X = rbind(X, c(-1, 1))

library(mlpack)
m = random_forest(training = as.matrix(X),
                  labels = as.matrix(as.integer(X[,1])),
                  print_training_accuracy = TRUE,
                  num_trees = 10,
                  minimum_leaf_size = 3,
                  verbose = TRUE)
Attaching package: ‘mlpack’

The following object is masked from ‘package:stats’:

    kmeans

The following object is masked from ‘package:base’:

    det

[INFO ] Training random forest with 10 trees...

 *** caught segfault ***
address 0xfffffffffffffff0, cause 'memory not mapped'

Traceback:
 1: random_forest_mlpackMain()
 2: random_forest(training = as.matrix(X), labels = as.matrix(as.integer(X[,     1])), print_training_accuracy = TRUE, num_trees = 10, minimum_leaf_size = 3,     verbose = TRUE)
An irrecoverable exception occurred. R is aborting now ...

 *** caught segfault ***
address 0xfffffffffffffff8, cause 'memory not mapped'

 *** caught segfault ***
address 0xfffffffffffffff8, cause 'memory not mapped'

 *** caught segfault ***
address 0xfffffffffffffff0, cause 'memory not mapped'

 *** caught segfault ***
address 0xfffffffffffffff8, cause 'memory not mapped'

Traceback:
 1: random_forest_mlpackMain()
 2: random_forest(training = as.matrix(X), labels = as.matrix(as.integer(X[,     1])), print_training_accuracy = TRUE, num_trees = 10, minimum_leaf_size = 3,     verbose = TRUE)

 *** caught segfault ***
address 0xfffffffffffffff8, cause 'memory not mapped'

 *** caught segfault ***
address 0xfffffffffffffff8, cause 'memory not mapped'

Traceback:
 1: random_forest_mlpackMain()
 2: random_forest(training = as.matrix(X), labels = as.matrix(as.integer(X[,     1])), print_training_accuracy = TRUE, num_trees = 10, minimum_leaf_size = 3, An irrecoverable exception occurred. R is aborting now ...

 *** caught segfault ***
address 0xfffffffffffffff8, cause 'memory not mapped'

 *** caught segfault ***
address (nil), cause 'memory not mapped'

Traceback:
 1: random_forest_mlpackMain()
 2: 
 *** caught segfault ***

Traceback:

Traceback:
 1: random_forest_mlpackMain()
 2:  1: 
Traceback:
random_forest(training = as.matrix(X), labels = as.matrix(as.integer(X[,     verbose = TRUE)
Traceback:
address 0xfffffffffffffff0, cause 'memory not mapped'
random_forest(training = as.matrix(X), labels = as.matrix(as.integer(X[,     1])), print_training_accuracy = TRUE, num_trees = 10, minimum_leaf_size = 3,     verbose = TRUE)
An irrecoverable exception occurred. R is aborting now ...

An irrecoverable exception occurred. R is aborting now ...
random_forest_mlpackMain()
 2: random_forest(training = as.matrix(X), labels = as.matrix(as.integer(X[,     1])), print_training_accuracy = TRUE, num_trees = 10, minimum_leaf_size = 3,     verbose = TRUE)    1])), print_training_accuracy = TRUE, num_trees = 10, minimum_leaf_size = 3,     verbose = TRUE)
Traceback:
 1: random_forest_mlpackMain()

An irrecoverable exception occurred. R is aborting now ...

An irrecoverable exception occurred. R is aborting now ...
 2: random_forest(training = as.matrix(X), labels = as.matrix(as.integer(X[,     1])), print_training_accuracy = TRUE, num_trees = 10, minimum_leaf_size = 3,     verbose = TRUE)
An irrecoverable exception occurred. R is aborting now ...
 1: random_forest_mlpackMain()
 2: random_forest(training = as.matrix(X), labels = as.matrix(as.integer(X[,     1])), print_training_accuracy = TRUE, num_trees = 10, minimum_leaf_size = 3,     verbose = TRUE)
 1: random_forest_mlpackMain()
 2: random_forest(training = as.matrix(X), labels = as.matrix(as.integer(X[,     1])), print_training_accuracy = TRUE, num_trees = 10, minimum_leaf_size = 3,     verbose = TRUE)
An irrecoverable exception occurred. R is aborting now ...

Traceback:
An irrecoverable exception occurred. R is aborting now ...
 1: random_forest_mlpackMain()
 2: random_forest(training = as.matrix(X), labels = as.matrix(as.integer(X[,     ])), print_training_accuracy = TRUE, num_trees = 10, minimum_leaf_size = 3,     verbose = TRUE)
An irrecoverable exception occurred. R is aborting now ...
Segmentation fault

Version 3.4.2.1, installed from CRAN in linux, compiled with gcc10 with options -O3 and -march=native.

@coatless
Copy link
Contributor

Duplicate of #3021. We have a fix in PR #3034

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants