Changeset 10124:910ff8bac06c in orange


Ignore:
Timestamp:
02/08/12 19:41:53 (2 years ago)
Author:
lanumek
Branch:
default
rebase_source:
778574348140d07b8ff9d071bb2bfecc377ffa7c
Message:

Testing scripts for classifier from var

Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • Orange/fixes/fix_changed_names.py

    r10071 r10124  
    4444 
    4545           "orange.SymMatrix": "Orange.misc.SymMatrix", 
     46           "orange.ClassifierFromVar": "Orange.classification.ClassifierFromVar", 
     47           "orange.ClassifierFromVarFD": "Orange.classification.ClassifierFromVarFD", 
     48            
    4649 
    4750           "orange.GetValue": "Orange.classification:Classifier.GetValue", 
  • docs/reference/rst/code/transformvalue-d2c.py

    r10012 r10124  
    11import Orange.data 
    2 import Orange.feature 
    32 
    4 data = Orange.data.Table("monks-1") 
     3monks = Orange.data.Table("monks-1") 
    54 
    65e1 = Orange.feature.Continuous("e=1") 
    7 e1.getValueFrom = Orange.core.ClassifierFromVar(whichVar=data.domain["e"]) 
     6e1.getValueFrom = Orange.classification.ClassifierFromVar(whichVar=monks.domain["e"]) 
    87e1.getValueFrom.transformer = Orange.data.utils.Discrete2Continuous() 
    98 
  • docs/reference/rst/code/transformvalue-miv.py

    r9986 r10124  
    11import Orange 
    22 
    3 data = Orange.data.Table("lenses") 
    4 age = data.domain["age"] 
     3lenses = Orange.data.Table("lenses") 
     4age = lenses.domain["age"] 
    55 
    66age_b = Orange.feature.Discrete("age_c", values = ['young', 'old']) 
    7 age_b.getValueFrom = Orange.core.ClassifierFromVar(whichVar = age) 
     7age_b.getValueFrom = Orange.classification.ClassifierFromVar(whichVar = age) 
    88age_b.getValueFrom.transformer = Orange.data.utils.MapIntValue() 
    99age_b.getValueFrom.transformer.mapping = [0, 1, 1] 
    1010 
    11 newDomain = Orange.data.Domain([age_b, age], data.domain.classVar) 
    12 newData = Orange.data.Table(newDomain, data) 
     11newDomain = Orange.data.Domain([age_b, age], lenses.domain.classVar) 
     12newData = Orange.data.Table(newDomain, lenses) 
    1313for ex in newData: 
    1414    print ex 
  • docs/reference/rst/code/transformvalue-nc.py

    r10012 r10124  
    11import Orange 
    22 
    3 data = Orange.data.Table("iris") 
     3iris = Orange.data.Table("iris") 
    44 
    5 domstat = Orange.statistics.basic.Domain(data) 
     5domstat = Orange.statistics.basic.Domain(iris) 
    66newattrs = [] 
    7 for attr in data.domain.features: 
     7for attr in iris.domain.features: 
    88    attr_c = Orange.feature.Continuous(attr.name + "_n") 
    9     attr_c.getValueFrom = Orange.core.ClassifierFromVar(whichVar=attr) 
     9    attr_c.getValueFrom = Orange.classification.ClassifierFromVar(whichVar=attr) 
    1010    transformer = Orange.data.utils.NormalizeContinuous() 
    1111    attr_c.getValueFrom.transformer = transformer 
     
    1414    newattrs.append(attr_c) 
    1515 
    16 newDomain = Orange.data.Domain(newattrs, data.domain.classVar) 
    17 newData = Orange.data.Table(newDomain, data) 
     16newDomain = Orange.data.Domain(newattrs, iris.domain.classVar) 
     17newData = Orange.data.Table(newDomain, iris) 
    1818for ex in newData[:5]: 
    1919    print ex 
  • docs/reference/rst/code/transformvalue-o2c.py

    r9986 r10124  
    88import Orange.feature 
    99 
    10 data = Orange.data.Table("lenses") 
    11 age = data.domain["age"] 
     10lenses = Orange.data.Table("lenses") 
     11age = lenses.domain["age"] 
    1212 
    1313age_c = Orange.feature.Continuous("age_c") 
    14 age_c.getValueFrom = Orange.core.ClassifierFromVar(whichVar = age) 
     14age_c.getValueFrom = Orange.classification.ClassifierFromVar(whichVar = age) 
    1515age_c.getValueFrom.transformer = Orange.data.utils.Ordinal2Continuous() 
    1616 
    1717age_cn = Orange.feature.Continuous("age_cn") 
    18 age_cn.getValueFrom = Orange.core.ClassifierFromVar(whichVar = age) 
     18age_cn.getValueFrom = Orange.classification.ClassifierFromVar(whichVar = age) 
    1919age_cn.getValueFrom.transformer = Orange.data.utils.Ordinal2Continuous() 
    2020age_cn.getValueFrom.transformer.factor = 0.5 
    2121 
    22 newDomain = Orange.data.Domain([age, age_c, age_cn], data.domain.classVar) 
    23 newData = Orange.data.Table(newDomain, data) 
     22newDomain = Orange.data.Domain([age, age_c, age_cn], lenses.domain.classVar) 
     23newData = Orange.data.Table(newDomain, lenses) 
    2424for ex in newData: 
    2525    print ex 
Note: See TracChangeset for help on using the changeset viewer.