Skip to content

Crash in RandomForestClassifier.fit when passing in continuous target #6890

@jcrist

Description

@jcrist

In #6863 a test in the sklearn test suite was identified that causes RandomForestClassifier.fit to crash:

- "sklearn.tests.test_common::test_estimators[RandomForestClassifier()-check_classifiers_regression_target]"

This test tries passing a continuous target (e.g. a regression dataset) to a classifier, and expects the classifier to error appropriately notifying the user of their mistake.

Here's a reproducer with just cuml core:

from sklearn.datasets import make_regression
from cuml import RandomForestClassifier

X, y = make_regression(
    n_samples=200,
    n_features=10,
    n_informative=1,
    bias=5.0,
    noise=20,
    random_state=42,
)

model = RandomForestClassifier()
model.fit(X, y)

Output

$ python bug.py
terminate called after throwing an instance of 'raft::exception'
  what():  exception occurred! file=/raid/jcristharif/cuml/cpp/src/decisiontree/batched-levelalgo/builder.cuh line=513: Not enough shared memory. Consider reducing max_n_bins.
Obtained 7 stack frames
#1 in /raid/jcristharif/miniforge3/envs/cuml-dev/lib/libcuml++.so: ML::DT::Builder<ML::DT::GiniObjectiveFunction<double, int, int> >::computeSplit(int, unsigned long, unsigned long) +0x239 [0x7f5b41d617d9]
#2 in /raid/jcristharif/miniforge3/envs/cuml-dev/lib/libcuml++.so: ML::DT::Builder<ML::DT::GiniObjectiveFunction<double, int, int> >::doSplit(std::vector<ML::DT::NodeWorkItem, std::allocator<ML::DT::NodeWorkItem> > const&) +0x281 [0x7f5b41d77691]
#3 in /raid/jcristharif/miniforge3/envs/cuml-dev/lib/libcuml++.so: ML::DT::Builder<ML::DT::GiniObjectiveFunction<double, int, int> >::train() +0x4cc [0x7f5b41d8b66c]
#4 in /raid/jcristharif/miniforge3/envs/cuml-dev/lib/libcuml++.so(+0x88e929) [0x7f5b41d8d929]
#5 in /raid/jcristharif/miniforge3/envs/cuml-dev/lib/libgomp.so.1(+0x19ec4) [0x7f5b8c513ec4]
#6 in /lib/x86_64-linux-gnu/libpthread.so.0(+0x8609) [0x7f5eff534609]
#7 in /lib/x86_64-linux-gnu/libc.so.6: clone +0x43 [0x7f5eff2ff353]

Aborted (core dumped)

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingsklearn-api-compatIssues around cuml matching sklearn API conventions/standards

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions