# source:orange/docs/reference/rst/Orange.statistics.basic.rst@10397:229ea74dc7b5

Revision 10397:229ea74dc7b5, 3.5 KB checked in by janezd <janez.demsar@…>, 2 years ago (diff)

Added module names to toc entries for statistics.*

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