Ask Your Question
0

Jupyter kernel crashes after running "train" for decision tree classifier

asked 2019-08-18 23:43:41 -0500

evgevd gravatar image

I tried to perform training on my data and on toy example too. Command prompt doesnt show anything but the message about restarting.

segm_features = np.array([[1,0], [1,1], [0,1]])
labels = np.array([1,0,0])
cv_model = cv.ml.DTrees_create()
dtype = np.int32
train_data = cv.ml.TrainData_create(segm_features.astype(np.float32), cv.ml.ROW_SAMPLE, labels.astype(dtype))

cv_model.train(train_data)
edit retag flag offensive close merge delete

Comments

1

dtree crashes with default params (neither a jupyter nor python specific problem)

cv2.__version__ ?

berak gravatar imageberak ( 2019-08-19 03:19:21 -0500 )edit
1
  • 3.4.2.17
  • with 4.1.0.25 too
evgevd gravatar imageevgevd ( 2019-08-19 03:43:10 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2019-08-19 04:19:54 -0500

berak gravatar image

it's probably a bug (in c++ already), the default constructor for DTrees is not usable, you need to set 2 additional params, like:

cv_model = cv2.ml.DTrees_create()
cv_model.setCVFolds(0)
cv_model.setMaxDepth(10)
edit flag offensive delete link more

Comments

It works! Thanx!

evgevd gravatar imageevgevd ( 2019-08-19 05:30:02 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2019-08-18 23:43:41 -0500

Seen: 12 times

Last updated: Aug 19