Ticket #1140 (closed bug: fixed)

Opened 3 years ago

Last modified 3 years ago

SimpleTreeClassifier returns wrong type of distribution if probabilities are requested

Reported by: blaz Owned by: jurezb
Milestone: 2.5 Component: library
Severity: major Keywords:
Cc: Blocking:
Blocked By:


The following code

import Orange

data = Orange.data.Table("iris")
domain = Orange.data.Domain(data.domain.features)
d = Orange.data.Instance(domain, list(data[0])[:-1])
tree_learner = Orange.classification.tree.SimpleTreeLearner()
classifier = tree_learner(data)
print type(classifier(d, 1))

should print out <type 'Orange.statistics.distribution.Discrete'> but instead prints out <type 'Orange.statistics.distribution.Continuous'>. Strangely, change the data to "voting" and the result is correct.

This bug is almost harmless if it would not hurt the random forest. The following code:

import Orange
data = Orange.data.Table("iris")
rf = Orange.ensemble.forest.RandomForestLearner(data)
d = Orange.data.Instance(domain, list(data[0])[:-1])
print rf(d, Orange.core.GetProbabilities)

crashes with TypeError: 'Orange.statistics.distribution.Continuous' object is not iterable.

Change History

comment:1 Changed 3 years ago by jurezb

I can't reproduce it on Linux. The attached code outputs <type 'Orange.statistics.distribution.Discrete'> with iris and voting. Can you try with the latest sources and a fresh build? Maybe it's OS related?

comment:2 Changed 3 years ago by blaz

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

In the latest version of Orange (Mar 15) this bug is fixed. Thanks.

Note: See TracTickets for help on using tickets.