Orange Forum • View topic - Still bug in proportionTest of orngTest

Still bug in proportionTest of orngTest

Report bugs (or imagined bugs).
(Archived/read-only, please use our ticketing system for reporting bugs and their discussion.)
Forum rules
Archived/read-only, please use our ticketing system for reporting bugs and their discussion.

Still bug in proportionTest of orngTest

Postby bgbg » Sun May 02, 2010 13:31

This report refers to this one: http://www.ailab.si/orange/forum/viewtopic.php?t=519

Currently orngTest looks like this (line 148 and up):

Code: Select all
    if examples.domain.classVar.varType == orange.VarTypes.Discrete:
        values = list(examples.domain.classVar.values)
        basevalue = examples.domain.classVar.baseValue
    else:
        basevalue = values = None
        classVar = examples.domain.classVar
        if examples.domain.classVar.varType == orange.VarTypes.Discrete:
            values = classVar.values.native()
            baseValue = classVar.baseValue
        else:
            values = None
            baseValue = -1
        testResults = ExperimentResults(times, [l.name for l in learners], values, weight!=0, baseValue)


Note that there might be cases where testResults is never initialized. Also note the confusing use of basevalue (no capitals) and baseValue (capital V).

I suggest the following:
Code: Select all
    if examples.domain.classVar.varType == orange.VarTypes.Discrete:
        values = list(examples.domain.classVar.values)
        baseValue = examples.domain.classVar.baseValue
    else:
        baseValue = values = None
        classVar = examples.domain.classVar
        if examples.domain.classVar.varType == orange.VarTypes.Discrete:
            values = classVar.values.native()
            baseValue = classVar.baseValue
        else:
            values = None
            baseValue = -1
    testResults = ExperimentResults(times, [l.name for l in learners], values, weight!=0, baseValue)

Return to Bugs