source: orange/docs/reference/rst/Orange.classification.constant.rst @ 10375:e29f566e9513

Revision 10375:e29f566e9513, 1.7 KB checked in by janezd <janez.demsar@…>, 2 years ago (diff)

Moved documentation about ConstantClassifier to a separate page

Line 
1.. py:currentmodule:: Orange.classification
2
3Constant Classifier
4-------------------
5
6Constant classifier always predicts the same value. It is constructed
7by various learners such as
8:obj:`~Orange.classification.majority.MajorityLearner`, and also used
9in other places.
10
11.. class:: ConstantClassifier
12
13    Always predict the specified ``default_val`` or
14    ``default_distribution``, disregarding the instance.
15
16    .. attribute:: class_var
17
18        Class variable that the classifier predicts.
19
20    .. attribute:: default_val
21
22        The value returned by the classifier.
23
24    .. attribute:: default_distribution
25
26        Class probabilities returned by the classifier.
27   
28    .. method:: __init__(variable, value, distribution)
29
30        Constructor can be called without arguments, with a
31        variable, value or both. If the value is given and is of type
32        :obj:`Orange.data.Value`, its attribute
33        :obj:`Orange.data.Value.variable` will either be used for
34        initializing
35        :obj:`~Orange.classification.ConstantClassifier.variable` or
36        checked against it, if :obj:`variable` is given as an
37        argument.
38       
39        :param variable: Class variable that the classifier predicts.
40        :type variable: :obj:`Orange.feature.Descriptor`
41        :param value: Value returned by the classifier.
42        :type value: :obj:`Orange.data.Value` or int (index) or float
43        :param distribution: Class probabilities returned by the classifier.
44        :type dstribution: :obj:`Orange.statistics.distribution.Distribution`
45       
46    .. method:: __call__(instance, return_type)
47       
48        Return :obj:`default_val` and/or :obj:`default_distribution`
49        (depending upon :obj:`return_type`) disregarding the
50        :obj:`instance`.
51
52
53
Note: See TracBrowser for help on using the repository browser.