Changeset 4636:6d1aa0455d6e in orange


Ignore:
Timestamp:
05/10/08 00:35:40 (6 years ago)
Author:
janezd <janez.demsar@…>
Branch:
default
Convert:
62c21d287839c513e2fc4dfde2be6bc61efc9eb3
Message:
  • a list of examples is now also accepted by the learner (besides ExampleTable)
Location:
orange
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orange/orngCN2.py

    r4593 r4636  
    115115 
    116116def supervisedClassCheck(examples): 
    117     if not examples.domain.classVar: 
     117    # examples[0] to make it work on a list of examples, too 
     118    if not examples[0].domain.classVar: 
    118119        raise Exception("Class variable is required!") 
    119     if examples.domain.classVar.varType == orange.VarTypes.Continuous: 
     120    if examples[0].domain.classVar.varType == orange.VarTypes.Continuous: 
    120121        raise Exception("CN2 requires a discrete class!") 
    121122     
  • orange/orngTree.py

    r3727 r4636  
    2525            self.learner = self.instance() 
    2626        if not hasattr(self, "split") and not hasattr(self, "measure"): 
    27             if examples.domain.classVar.varType == orange.VarTypes.Discrete: 
     27            # this should also work for lists of examples, not just ExampleTable 
     28            if examples[0].domain.classVar.varType == orange.VarTypes.Discrete: 
    2829                measure = orange.MeasureAttribute_gainRatio() 
    2930            else: 
Note: See TracChangeset for help on using the changeset viewer.