Ticket #827 (closed bug: fixed)

Opened 3 years ago

Last modified 3 years ago

forest of user-defined tree learners crashes

Reported by: blaz Owned by: marko
Milestone: 2.6 Component: orng_modules
Severity: immediate Keywords:
Cc: Blocking:
Blocked By:

Description

Defining your own learner and then using it for forest induction fails. The following example uses iris.tab:

import Orange

tree = Orange.classification.tree.TreeLearner()
tree.maxDepth = 5
tree.split = Orange.ensemble.forest.SplitConstructor_AttributeSubset(tree.split, 3)

forest = Orange.ensemble.forest.RandomForestLearner(learner=tree, trees=5, name="forest")

data = Orange.data.Table("iris.tab")
forest(data)

Responsible is the line

tree.split = Orange.ensemble.forest.SplitConstructor_AttributeSubset(tree.split, 3)

After removing it the stuff works.

Change History

comment:1 Changed 3 years ago by marko

In [10799]:

(The changeset message doesn't reference this ticket)

comment:2 Changed 3 years ago by marko

In [10815]:

(The changeset message doesn't reference this ticket)

comment:3 Changed 3 years ago by marko

In [10830]:

(The changeset message doesn't reference this ticket)

comment:4 Changed 3 years ago by marko

  • Status changed from new to closed
  • Resolution set to fixed

In [10835]:

(The changeset message doesn't reference this ticket)

comment:5 Changed 3 years ago by marko

The same results can now be obtained also with the following code (this way is actually preferred). Notice that base_learner is used instead of learner and that SplitConstructor_AttributeSubset gets added automatically.

import Orange

tree = Orange.classification.tree.TreeLearner()
tree.maxDepth = 5

forest = Orange.ensemble.forest.RandomForestLearner(base_learner=tree, trees=5, name="forest", attributes=3)

data = Orange.data.Table("iris.tab")
forest(data)
Note: See TracTickets for help on using tickets.