Changeset 7379:7900e43ae7e8 in orange


Ignore:
Timestamp:
02/04/11 01:28:39 (3 years ago)
Author:
janezd <janez.demsar@…>
Branch:
default
Convert:
2743a3c1b625d49ea8f3031bd095a2eef870f90f
Message:
  • improved documentation
Location:
orange
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orange/Orange/data/feature.py

    r7338 r7379  
    88features are stored in descriptors contained in this module. 
    99 
     10Feature Descriptors 
     11------------------- 
     12 
    1013Feature descriptors can be constructed directly, using constructors, or by a 
    1114factory function :obj:`make`, which either retrieves an existing descriptor or 
     
    1720 
    1821    .. attribute:: name 
    19      
    20     Each feature has a name. The names do not need to be unique since two 
    21     features are considered the same only if they have the same descriptor 
    22     (e.g. even multiple features in the same table can have the same name). 
    23     This should however be avoided since it may result in unpredictable 
    24     behaviour. 
     22 
     23        Each feature has a name. The names do not need to be unique since two 
     24        features are considered the same only if they have the same descriptor 
     25        (e.g. even multiple features in the same table can have the same name). 
     26        This should however be avoided since it may result in unpredictable 
     27        behaviour. 
    2528     
    2629    .. attribute:: varType 
    2730        
    28     Stores the feature type; it can be Orange.data.Type.Discrete, 
    29     Orange.data.Type.Continuous, Orange.data.Type.String or 
    30     Orange.data.Type.Other.   
     31        Stores the feature type; it can be Orange.data.Type.Discrete, 
     32        Orange.data.Type.Continuous, Orange.data.Type.String or 
     33        Orange.data.Type.Other.   
    3134 
    3235    .. attribute:: getValueFrom 
    3336 
    34     A function (an instance of :obj:`Orange.core.Clasifier`) which computes a 
    35     value of the feature from values of one or more other features. This is 
    36     used, for instance, in discretization where the features describing the  
    37     discretized feature are computed from the original feature.  
     37        A function (an instance of :obj:`Orange.core.Clasifier`) which computes a 
     38        value of the feature from values of one or more other features. This is 
     39        used, for instance, in discretization where the features describing the  
     40        discretized feature are computed from the original feature.  
    3841 
    3942    .. attribute:: ordered 
    4043     
    41     A flag telling whether the values of a discrete feature are ordered. At the  
    42     moment, no builtin method treats ordinal features differently than nominal. 
     44        A flag telling whether the values of a discrete feature are ordered. At 
     45        the moment, no builtin method treats ordinal features differently than 
     46        nominal. 
    4347     
    4448    .. attribute:: distributed 
    4549     
    46     A flag telling whether the values of this features are distributions. 
    47     As for flag ordered, no methods treat such features in any special manner. 
     50        A flag telling whether the values of this features are distributions. 
     51        As for flag ordered, no methods treat such features in any special 
     52        manner. 
    4853     
    4954    .. attribute:: randomGenerator 
    5055     
    51     A local random number generator used by method :obj:`Feature.randomvalue`. 
     56        A local random number generator used by method 
     57        :obj:`Feature.randomvalue`. 
    5258     
    5359    .. attribute:: defaultMetaId 
    5460     
    55     A proposed (but not guaranteed) meta id to be used for that feature. This is  
    56     used, for instance, by the data loader for tab-delimited file format instead  
    57     of assigning an arbitrary new value, or by :obj:`Orange.core.newmetaid` if the 
    58     feature is passed as an argument.  
     61        A proposed (but not guaranteed) meta id to be used for that feature. 
     62        This is used, for instance, by the data loader for tab-delimited file 
     63        format instead of assigning an arbitrary new value, or by 
     64        :obj:`Orange.core.newmetaid` if the feature is passed as an argument.  
    5965         
    6066    .. method:: __call__(obj) 
    6167     
    62        Convert a string, number or other suitable object into a feature value. 
    63         
    64        :param obj: An object to be converted into a feature value 
    65        :type o: any suitable 
    66        :rtype: :class:`Orange.data.Value` 
     68           Convert a string, number or other suitable object into a feature 
     69           value. 
     70            
     71           :param obj: An object to be converted into a feature value 
     72           :type o: any suitable 
     73           :rtype: :class:`Orange.data.Value` 
    6774        
    6875    .. method:: randomvalue() 
    6976 
    70        Return a random value of the feature 
     77           Return a random value of the feature 
    7178        
    72        :rtype: :class:`Orange.data.Value` 
     79           :rtype: :class:`Orange.data.Value` 
    7380        
    7481    .. method:: computeValue(inst) 
    7582 
    76        Compute the value of the feature given the instance by calling 
    77        `getValueFrom` through a mechanism that prevents deadlocks by 
    78        circular calls. 
    79  
    80        :rtype: :class:`Orange.data.Value` 
     83           Compute the value of the feature given the instance by calling 
     84           `getValueFrom` through a mechanism that prevents deadlocks by 
     85           circular calls. 
     86 
     87           :rtype: :class:`Orange.data.Value` 
    8188 
    8289.. _discrete: 
     
    8794    .. attribute:: values 
    8895     
    89     A list with symbolic names for feature's values. Values are stored as 
    90     indices referring to this list. Therefore, modifying this list instantly 
    91     changes (symbolic) names of values as they are printed out or referred to 
    92     by user. 
    93      
    94     .. note:: 
    95      
    96         The size of the list is also used to indicate the number of possible values  
    97         for this feature. Changing the size, especially shrinking the list can have  
    98         disastrous effects and is therefore not really recommendable. Also, do not  
    99         add values to the list by calling its append or extend method: call  
    100         the :obj:`addValue` method instead described below. 
    101  
    102         It is also assumed that this attribute is always defined (but can be empty),  
    103         so never set it to None. 
     96        A list with symbolic names for feature's values. Values are stored as 
     97        indices referring to this list. Therefore, modifying this list instantly 
     98        changes (symbolic) names of values as they are printed out or referred to 
     99        by user. 
     100     
     101        .. note:: 
     102         
     103            The size of the list is also used to indicate the number of 
     104            possible values for this feature. Changing the size, especially 
     105            shrinking the list can have disastrous effects and is therefore not 
     106            really recommendable. Also, do not add values to the list by 
     107            calling its append or extend method: call the :obj:`addValue` 
     108            method instead described below. 
     109 
     110            It is also assumed that this attribute is always defined (but can 
     111            be empty), so never set it to None. 
    104112     
    105113    .. attribute:: baseValue 
    106114 
    107     Stores the base value for the feature as an index into `values`. This can 
    108     be, for instance a "normal" value, such as "no complications" as opposed to  
    109     abnormal "low blood pressure". The base value is used by certain statistics,  
    110     continuization etc. potentially, learning algorithms. Default is -1 and  
    111     means that there is no base value. 
     115            Stores the base value for the feature as an index into `values`. 
     116            This can be, for instance a "normal" value, such as "no 
     117            complications" as opposed to abnormal "low blood pressure". The 
     118            base value is used by certain statistics, continuization etc. 
     119            potentially, learning algorithms. Default is -1 and means that 
     120            there is no base value. 
    112121     
    113122    .. method:: addValue 
    114123     
    115     Adds a value to values. Always call this function instead of appending to 
    116     values. 
     124            Adds a value to values. Always call this function instead of 
     125            appending to values. 
    117126 
    118127.. _continuous: 
     
    123132    .. attribute:: numberOfDecimals 
    124133     
    125     The number of decimals used when the value is printed out, converted to a 
    126     string or saved to a file  
     134        The number of decimals used when the value is printed out, converted to 
     135        a string or saved to a file  
    127136     
    128137    .. attribute:: scientificFormat 
    129138     
    130     If ``True``, the value is printed in scientific format whenever it would 
    131     have more than 5 digits. In this case, `numberOfDecimals` is ignored. 
     139        If ``True``, the value is printed in scientific format whenever it would 
     140        have more than 5 digits. In this case, `numberOfDecimals` is ignored. 
    132141 
    133142    .. attribute:: adjustDecimals 
    134143     
    135     Tells Orange to monitor the number of decimals when the value is converted 
    136     from a string (when the values are read from a file or converted by, e.g. 
    137     ``inst[0]="3.14"``). The value of ``0`` means that the number of decimals  
    138     should not be adjusted, while 1 and 2 mean that adjustments are on, with 2  
    139     denoting that no values have been converted yet. 
    140  
    141     By default, adjustment of number of decimals goes as follows. 
    142      
    143     If the feature was constructed when data was read from a file, it will be 
    144     printed with the same number of decimals as the largest number of decimals 
    145     encountered in the file. If scientific notation occurs in the file, 
    146     `scientificFormat` will be set to ``True`` and scientific format will be used 
    147     for values too large or too small. 
    148      
    149     If the feature is created in a script, it will have, by default, three 
    150     decimals places. This can be changed either by setting the value 
    151     from a string (e.g. ``inst[0]="3.14"``, but not ``inst[0]=3.14``) or by 
    152     manually setting the `numberOfDecimals`. 
     144        Tells Orange to monitor the number of decimals when the value is 
     145        converted from a string (when the values are read from a file or 
     146        converted by, e.g. ``inst[0]="3.14"``). The value of ``0`` means that 
     147        the number of decimals should not be adjusted, while 1 and 2 mean that 
     148        adjustments are on, with 2 denoting that no values have been converted 
     149        yet. 
     150 
     151        By default, adjustment of number of decimals goes as follows. 
     152     
     153        If the feature was constructed when data was read from a file, it will  
     154        be printed with the same number of decimals as the largest number of  
     155        decimals encountered in the file. If scientific notation occurs in the  
     156        file, `scientificFormat` will be set to ``True`` and scientific format  
     157        will be used for values too large or too small.  
     158     
     159        If the feature is created in a script, it will have, by default, three 
     160        decimals places. This can be changed either by setting the value 
     161        from a string (e.g. ``inst[0]="3.14"``, but not ``inst[0]=3.14``) or by 
     162        manually setting the `numberOfDecimals`. 
    153163 
    154164    .. attribute:: startValue, endValue, stepValue 
    155165     
    156     The range used for :obj:`randomvalue`. 
     166        The range used for :obj:`randomvalue`. 
    157167 
    158168.. _String: 
     
    334344    :param ordered_values: a list of ordered values 
    335345    :param unordered_values: a list of values, for which the order does not matter 
    336     :param createNewOn: gives condition for constructing a new feature instead 
    337     of using the new one 
     346    :param createNewOn: gives condition for constructing a new feature instead of using the new one 
    338347     
    339348.. function:: Orange.data.feature.retrieve(name, type, ordered_values, onordered_values[, createNewOn]) 
     
    346355    :param ordered_values: a list of ordered values 
    347356    :param unordered_values: a list of values, for which the order does not matter 
    348     :param createNewOn: gives condition for constructing a new feature instead 
    349     of using the new one 
     357    :param createNewOn: gives condition for constructing a new feature instead of using the new one 
    350358     
    351359.. _`feature-reuse.py`: code/feature-reuse.py 
  • orange/doc/Orange/rst/orange.data.feature.rst

    r7338 r7379  
    1 ============== 
    2 orange.data.feature 
    3 ============== 
     1=================== 
     2Orange.data.feature 
     3=================== 
    44 
    55.. automodule:: Orange.data.feature 
Note: See TracChangeset for help on using the changeset viewer.