Changeset 10368:28f5cab86b85 in orange


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

Moved documentation for classification.majority to rst and polished it

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • Orange/classification/majority.py

    r10191 r10368  
    1 """ 
    2 *********************** 
    3 Majority (``majority``) 
    4 *********************** 
    5  
    6 .. index:: majority classifier 
    7    pair: classification; majority classifier 
    8  
    9 Accuracy of classifiers is often compared to the "default accuracy", 
    10 that is, the accuracy of a classifier which classifies all instances 
    11 to the majority class. To fit into the standard schema, even this 
    12 algorithm is provided in form of the usual learner-classifier pair. 
    13 Learning is done by :obj:`MajorityLearner` and the classifier it 
    14 constructs is an instance of :obj:`ConstantClassifier`. 
    15  
    16 .. class:: MajorityLearner 
    17  
    18     MajorityLearner will most often be used as is, without setting any 
    19     parameters. Nevertheless, it has two. 
    20  
    21     .. attribute:: estimator_constructor 
    22      
    23         An estimator constructor that can be used for estimation of 
    24         class probabilities. If left None, probability of each class is 
    25         estimated as the relative frequency of instances belonging to 
    26         this class. 
    27          
    28     .. attribute:: apriori_distribution 
    29      
    30         Apriori class distribution that is passed to estimator 
    31         constructor if one is given. 
    32  
    33 .. class:: ConstantClassifier 
    34  
    35     ConstantClassifier always classifies to the same class and reports the 
    36     same class probabilities. 
    37  
    38     Its constructor can be called without arguments, with a variable (for 
    39     :obj:`class_var`), value (for :obj:`default_val`) or both. If the value 
    40     is given and is of type :obj:`Orange.data.Value` (alternatives are an 
    41     integer index of a discrete value or a continuous value), its attribute 
    42     :obj:`Orange.data.Value.variable` will either be used for initializing 
    43     :obj:`class_var` if variable is not given as an argument, or checked 
    44     against the variable argument, if it is given.  
    45      
    46     .. attribute:: default_val 
    47      
    48         Value that is returned by the classifier. 
    49      
    50     .. attribute:: default_distribution 
    51  
    52         Class probabilities returned by the classifier. 
    53      
    54     .. attribute:: class_var 
    55      
    56         Class variable that the classifier predicts. 
    57  
    58  
    59 Examples 
    60 ======== 
    61  
    62 This "learning algorithm" will most often be used as a baseline, 
    63 that is, to determine if some other learning algorithm provides 
    64 any information about the class (:download:`majority-classification.py <code/majority-classification.py>`): 
    65  
    66 .. literalinclude:: code/majority-classification.py 
    67     :lines: 7- 
    68  
    69 """ 
    70  
    711from Orange import core 
    722 
  • docs/reference/rst/Orange.classification.majority.rst

    r9372 r10368  
    1 .. automodule:: Orange.classification.majority 
     1.. py:currentmodule:: Orange.classification.majority 
     2 
     3*********************** 
     4Majority (``majority``) 
     5*********************** 
     6 
     7.. index:: majority classifier 
     8   pair: classification; majority classifier 
     9 
     10Accuracy of classifiers is often compared to the "default accuracy", 
     11that is, the accuracy of a classifier which classifies all instances 
     12to the majority class. The training of such classifier consists of 
     13computing the class distribution and its modus. The model is represented as an instance of :obj:`Orange.classification.ConstantClassifier`. 
     14 
     15.. class:: MajorityLearner 
     16 
     17    MajorityLearner has two components, which are seldom used. 
     18 
     19    .. attribute:: estimator_constructor 
     20     
     21        An estimator constructor that can be used for estimation of 
     22        class probabilities. If left None, probability of each class is 
     23        estimated as the relative frequency of instances belonging to 
     24        this class. 
     25         
     26    .. attribute:: apriori_distribution 
     27     
     28        Apriori class distribution that is passed to estimator 
     29        constructor if one is given. 
     30 
     31Example 
     32======== 
     33 
     34This "learning algorithm" will most often be used as a baseline, 
     35that is, to determine if some other learning algorithm provides 
     36any information about the class (:download:`majority-classification.py <code/majority-classification.py>`): 
     37 
     38.. literalinclude:: code/majority-classification.py 
     39    :lines: 7- 
Note: See TracChangeset for help on using the changeset viewer.