Ignore:
Timestamp:
02/29/12 13:05:25 (2 years ago)
Author:
janezd <janez.demsar@…>
Branch:
default
Message:

Moved doc for statistics.basic from py to rst

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Orange/statistics/basic.py

    r9994 r10399  
    1 """ 
    2 .. index:: Basic Statistics for Continuous Features 
    3  
    4 ======================================== 
    5 Basic Statistics for Continuous Features 
    6 ======================================== 
    7  
    8 The are two simple classes for computing basic statistics 
    9 for continuous features, such as their minimal and maximal value 
    10 or average: :class:`Orange.statistics.basic.Variable` holds the statistics for a single variable 
    11 and :class:`Orange.statistics.basic.Domain` behaves like a list of instances of 
    12 the above class for all variables in the domain. 
    13  
    14 .. class:: Variable 
    15  
    16     Computes and stores minimal, maximal, average and 
    17     standard deviation of a variable. It does not include the median or any 
    18     other statistics that can be computed on the fly, without remembering the 
    19     data; such statistics can be obtained classes from module :obj:`Orange.statistics.distribution`. 
    20  
    21     Instances of this class are seldom constructed manually; they are more often 
    22     returned by :obj:`Domain` described below. 
    23  
    24     .. attribute:: variable 
    25      
    26         The variable to which the data applies. 
    27  
    28     .. attribute:: min 
    29  
    30         Minimal value encountered 
    31  
    32     .. attribute:: max 
    33  
    34         Maximal value encountered 
    35  
    36     .. attribute:: avg 
    37  
    38         Average value 
    39  
    40     .. attribute:: dev 
    41  
    42         Standard deviation 
    43  
    44     .. attribute:: n 
    45  
    46         Number of instances for which the value was defined. 
    47         If instances were weighted, :obj:`n` holds the sum of weights 
    48          
    49     .. attribute:: sum 
    50  
    51         Weighted sum of values 
    52  
    53     .. attribute:: sum2 
    54  
    55         Weighted sum of squared values 
    56  
    57     .. 
    58         .. attribute:: holdRecomputation 
    59      
    60             Holds recomputation of the average and standard deviation. 
    61  
    62     .. method:: add(value[, weight=1]) 
    63      
    64         Add a value to the statistics: adjust :obj:`min` and :obj:`max` if 
    65         necessary, increase :obj:`n` and recompute :obj:`sum`, :obj:`sum2`, 
    66         :obj:`avg` and :obj:`dev`. 
    67  
    68         :param value: Value to be added to the statistics 
    69         :type value: float 
    70         :param weight: Weight assigned to the value 
    71         :type weight: float 
    72  
    73     .. 
    74         .. method:: recompute() 
    75  
    76             Recompute the average and deviation. 
    77  
    78 .. class:: Domain 
    79  
    80     ``statistics.basic.Domain`` behaves like an ordinary list, except that its 
    81     elements can also be indexed by variable names or descriptors. 
    82  
    83     .. method:: __init__(data[, weight=None]) 
    84  
    85         Compute the statistics for all continuous variables in the data, and put 
    86         :obj:`None` to the places corresponding to variables of other types. 
    87  
    88         :param data: A table of instances 
    89         :type data: Orange.data.Table 
    90         :param weight: The id of the meta-attribute with weights 
    91         :type weight: `int` or none 
    92          
    93     .. method:: purge() 
    94      
    95         Remove the :obj:`None`'s corresponding to non-continuous features; this 
    96         truncates the list, so the indices do not respond to indices of 
    97         variables in the domain. 
    98      
    99     part of :download:`distributions-basic-stat.py <code/distributions-basic-stat.py>` 
    100      
    101     .. literalinclude:: code/distributions-basic-stat.py 
    102         :lines: 1-10 
    103  
    104     Output:: 
    105  
    106              feature   min   max   avg 
    107         sepal length 4.300 7.900 5.843 
    108          sepal width 2.000 4.400 3.054 
    109         petal length 1.000 6.900 3.759 
    110          petal width 0.100 2.500 1.199 
    111  
    112  
    113     part of :download:`distributions-basic-stat.py <code/distributions-basic-stat.py>` 
    114      
    115     .. literalinclude:: code/distributions-basic-stat.py 
    116         :lines: 11- 
    117  
    118     Output:: 
    119  
    120         5.84333467484  
    121  
    122 """ 
    123  
    1241from Orange.core import BasicAttrStat as Variable 
    1252from Orange.core import DomainBasicAttrStat as Domain 
Note: See TracChangeset for help on using the changeset viewer.