Orange 2.5: code conversion

Orange 2.5 unifies Orange’s C++ core and Python modules into a single module hierarchy. To use the new module hierarchy, import Orange instead of orange and accompanying orng* modules. While we will maintain backward compatibility in 2.* releases, we nevertheless suggest programmers to use the new interface. The provided conversion tool can help refactor your code to use the new interface.

The conversion script,, resides in Orange’s main directory. To refactor from the “Orange for beginners” tutorial runpython -w -o doc/ofb-rst/code/

The old code

import orange
import orngTest, orngStat, orngTree

# set up the learners
bayes = orange.BayesLearner()
tree = orngTree.TreeLearner(mForPruning=2) = "bayes" = "tree"
learners = [bayes, tree]

# compute accuracies on data
data = orange.ExampleTable("voting")
res = orngTest.crossValidation(learners, data, folds=10)
cm = orngStat.computeConfusionMatrices(res,

is refactored to

import Orange

# set up the learners
bayes = Orange.classification.bayes.NaiveLearner()
tree = Orange.classification.tree.TreeLearner(mForPruning=2) = "bayes" = "tree"
learners = [bayes, tree]

# compute accuracies on data
data ="voting")
res = Orange.evaluation.testing.cross_validation(learners, data, folds=10)
cm = Orange.evaluation.scoring.compute_confusion_matrices(res,

Read more about the refactoring tool on the wiki and on the help page (python --help).

Orange 2.5 progress

We decided that we should reorganize Orange to provide more intuitive interface to the scripting interface. The next release, Orange 2.5 is getting better every day. But fear not, dear reader, we are working hard to ensure that your scripts will still work.

In the last morning of the camp in Bohinj we decided to use undercase_separated names instead of CamelCase. We have been steadily converting them and the deprecation utilities by Aleš help a lot. We just list the name changes for class attributes or arguments and their renaming is handled gracefully; they also remain accessible with the old names. Therefore, the code does not need to be duplicated to ensure backwards compatibility.

A simple example from the documentation of bagging and boosting. The old version first:

import orange, orngEnsemble, orngTree
import orngTest, orngStat

tree = orngTree.TreeLearner(mForPruning=2, name="tree")
bs = orngEnsemble.BoostedLearner(tree, name="boosted tree")
bg = orngEnsemble.BaggedLearner(tree, name="bagged tree")

data = orange.ExampleTable("")

learners = [tree, bs, bg]
results = orngTest.crossValidation(learners, data, folds=3)
print "Classification Accuracy:"
for i in range(len(learners)):
    print ("%15s: %5.3f") % (learners[i].name, orngStat.CA(results)[i])

Orange 2.5 version:

import Orange

tree = Orange.classification.tree.TreeLearner(m_pruning=2, name="tree")
bs = Orange.ensemble.boosting.BoostedLearner(tree, name="boosted tree")
bg = Orange.ensemble.bagging.BaggedLearner(tree, name="bagged tree")

table ="")

learners = [tree, bs, bg]
results = Orange.evaluation.testing.cross_validation(learners, table, folds=3)
print "Classification Accuracy:"
for i in range(len(learners)):
    print ("%15s: %5.3f") % (learners[i].name, Orange.evaluation.scoring.CA(results)[i])

In new Orange we only need to import a single module, Orange, the root of the new hierarchy.

Biolab retreat Februar 2011

From Wednesday, 2nd February 2011, to Saturday, 5th February 2011, we have been on working retreat at Lake Bohinj. The whole Bioinformatics Laboratory of the Faculty of Computer and Information technology has temporary moved to a nice house just few meters from the lake, enjoing the nature and without any distractions. Plan: working on the next version of Orange, Orange 2.5 and documentation rewrite. Orange 2.5 will have a better and restructured Python scripting interface along with great and shinny documentation.

Overall summary of the retreat: first commit (revision 9743) by Marko on Wednesday, last commit (revision 10181) by Matija at 1:26:49 on Saturday. This gives 439 revisions made during the retreat.

Some photos to give you a taste how it was.

WorkingWorkingPlayingPlayingNatureNaturePlanningPlaying frisbeeTripGroup photoNatureNatureGroup photoTripGroup photoNatureNatureNatureWorkingWorkingWorkingWorkingWorkingNatureWorkingWorkingPlanningPlanningPlanningPlanningPlanningPlanningWorkingNatureNatureWorkingWorkingWorking