Ignore:
Timestamp:
02/07/12 13:16:54 (2 years ago)
Author:
markotoplak
Branch:
default
Message:

data.variable -> feature

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Orange/classification/lookup.py

    r9671 r9919  
    1919 
    2020A natural habitat for these classifiers is feature construction: 
    21 they usually reside in :obj:`~Orange.data.variable.Variable.get_value_from` fields of constructed 
     21they usually reside in :obj:`~Orange.feature.Descriptor.get_value_from` fields of constructed 
    2222features to facilitate their automatic computation. For instance, 
    2323the following script shows how to translate the :download:`monks-1.tab <code/monks-1.tab>` data set 
     
    302302    ['1', '3', '2', '0'] <12.000, 0.000> 
    303303 
    304 ClassifierByDataTable will usually be used by :obj:`Orange.data.variable.Variable.get_value_from`. So, we 
     304ClassifierByDataTable will usually be used by :obj:`Orange.feature.Descriptor.get_value_from`. So, we 
    305305would probably continue this by constructing a new feature and put the 
    306 classifier into its :obj:`Orange.data.variable.Variable.get_value_from`. 
    307  
    308     >>> y2 = Orange.data.variable.Discrete("y2", values = ["0", "1"]) 
     306classifier into its :obj:`Orange.feature.Descriptor.get_value_from`. 
     307 
     308    >>> y2 = Orange.feature.Discrete("y2", values = ["0", "1"]) 
    309309    >>> y2.get_value_from = abe 
    310310 
     
    321321the new class variable and the features that should be used for 
    322322classification. This saves us from constructing data_s and reassigning 
    323 the class_var. It doesn't set the :obj:`Orange.data.variable.Variable.get_value_from`, though. 
     323the class_var. It doesn't set the :obj:`Orange.feature.Descriptor.get_value_from`, though. 
    324324 
    325325part of :download:`lookup-table.py <code/lookup-table.py>` (uses: :download:`monks-1.tab <code/monks-1.tab>`):: 
     
    330330    a, b, e = table.domain["a"], table.domain["b"], table.domain["e"] 
    331331 
    332     y2 = Orange.data.variable.Discrete("y2", values = ["0", "1"]) 
     332    y2 = Orange.feature.Discrete("y2", values = ["0", "1"]) 
    333333    abe2 = Orange.classification.lookup.LookupLearner(y2, [a, b, e], table) 
    334334 
     
    380380    as follows. 
    381381     
    382         >>> newvar = Orange.data.variable.Discrete() 
     382        >>> newvar = Orange.feature.Discrete() 
    383383        >>> bound = [table.domain[name] for name in ["a", "b"]] 
    384384        >>> lookup = lookup_from_bound(newvar, bound) 
     
    407407     
    408408        >>> bound = [table.domain[name] for name in ["a", "b"]] 
    409         >>> newVar = Orange.data.variable.Discrete("a=b", values=["no", "yes"]) 
     409        >>> newVar = Orange.feature.Discrete("a=b", values=["no", "yes"]) 
    410410        >>> lookup = lookup_from_function(newVar, bound, lambda x: x[0] == x[1]) 
    411411        >>> newVar.get_value_from = lookup 
     
    429429    (either when needed by addAnAttribute or at some other place), lookup 
    430430    should be used to compute newVar's value. (A bit off topic, but 
    431     important: you should never call :obj:`Orange.data.variable.Variable.get_value_from` directly, but always call 
     431    important: you should never call :obj:`Orange.feature.Descriptor.get_value_from` directly, but always call 
    432432    it through computeValue.) 
    433433 
     
    450450    dump_lookup_function returns a string with a lookup function in 
    451451    tab-delimited format. Argument func can be any of the above-mentioned 
    452     classifiers or a feature whose :obj:`Orange.data.variable.Variable.get_value_from` points to one of such 
     452    classifiers or a feature whose :obj:`Orange.feature.Descriptor.get_value_from` points to one of such 
    453453    classifiers. 
    454454 
     
    536536         
    537537def dump_lookup_function(func): 
    538     if isinstance(func, Orange.data.variable.Variable): 
     538    if isinstance(func, Orange.feature.Descriptor): 
    539539        if not func.get_value_from: 
    540540            raise TypeError, "attribute '%s' does not have an associated function" % func.name 
Note: See TracChangeset for help on using the changeset viewer.