Changeset 10075:bf51529fbccd in orange


Ignore:
Timestamp:
02/08/12 14:55:40 (2 years ago)
Author:
Lan Zagar <lan.zagar@…>
Branch:
default
rebase_source:
d99689ccaa8cca3bdf78755a986d19e98065fb79
Message:

Removed multiple locations of ConstantClassifier and moved its documentation.

Files:
5 edited

Legend:

Unmodified
Added
Removed
  • Orange/classification/majority.py

    r9994 r10075  
    7070 
    7171from Orange.core import MajorityLearner 
    72 from Orange.core import DefaultClassifier as ConstantClassifier 
  • Orange/classification/rules.py

    r9994 r10075  
    15871587        self.default_value = default_value 
    15881588    def __call__(self, examples, weight_id=0): 
    1589         return Orange.classification.majority.ConstantClassifier(self.default_value, defaultDistribution=Orange.core.Distribution(examples.domain.class_var, examples, weight_id)) 
     1589        return Orange.classification.ConstantClassifier(self.default_value, defaultDistribution=Orange.core.Distribution(examples.domain.class_var, examples, weight_id)) 
    15901590 
    15911591class ABCN2Ordered(ABCN2): 
  • Orange/classification/tree.py

    r10024 r10075  
    698698 
    699699    This pruner will only prune the nodes in which the node classifier 
    700     is a :obj:`~Orange.classification.majority.ConstantClassifier` 
     700    is a :obj:`~Orange.classification.ConstantClassifier` 
    701701    (or a derived class). 
    702702 
  • Orange/regression/mean.py

    r9994 r10075  
    3434 
    3535from Orange.core import MajorityLearner as MeanLearner 
    36 from Orange.core import DefaultClassifier as ConstantClassifier 
  • docs/reference/rst/Orange.classification.rst

    r9887 r10075  
    88parts, a Learner and a Classifier. A learner is constructed with all 
    99parameters that will be used for learning. When a data table is passed to its 
    10 __call__ method, a model is fitted to the data and return in a form of a 
     10__call__ method, a model is fitted to the data and returned in the form of a 
    1111Classifier, which is then used for predicting the dependent variable(s) of 
    1212new instances. 
     
    3939 
    4040 
    41     .. method:: __call__(instances, return_type) 
     41    .. method:: __call__(instance, return_type) 
    4242 
    4343        Classify a new instance using this model. 
     
    5757              tuple with both 
    5858 
    59  
    6059When developing new prediction models, one should extend :obj:`Learner` and 
    6160:obj:`Classifier`\. Code that infers the model from the data should be placed 
     
    6564:class:`~Orange.statistics.distribution.Distribution` or a tuple with both 
    6665based on the value of the parameter :obj:`return_type`. 
     66     
    6767 
    6868Orange implements various classifiers that are described in detail on 
     
    8080   Orange.classification.svm 
    8181   Orange.classification.tree 
     82 
     83Constant Classifier 
     84------------------- 
     85 
     86The classification module also contains a classifier that always predicts 
     87constant values regardless of given data instances. It is usually not used 
     88directly but through other other learners and methods, such as 
     89:obj:`~Orange.classification.majority.MajorityLearner`. 
     90 
     91.. class:: ConstantClassifier 
     92 
     93    ConstantClassifier always classifies to the same class and reports the 
     94    same class probabilities. 
     95 
     96    Its constructor can be called without arguments, with a variable (for 
     97    :obj:`class_var`), value (for :obj:`default_val`) or both. If the value 
     98    is given and is of type :obj:`Orange.data.Value` (alternatives are an 
     99    integer index of a discrete value or a continuous value), its attribute 
     100    :obj:`Orange.data.Value.variable` will either be used for initializing 
     101    :obj:`class_var` or checked against it, if :obj:`class_var` is given 
     102    as an argument.  
     103     
     104    .. method:: __init__(class_var, default_val, default_distribution) 
     105 
     106        The constructor can be called without arguments, with a variable 
     107        (for :obj:`class_var`), value (for :obj:`default_val`) or both. 
     108        If the value is given and is of type :obj:`Orange.data.Value` 
     109        (alternatives are an integer index of a discrete value or a continuous 
     110        value), its attribute :obj:`Orange.data.Value.variable` will either 
     111        be used for initializing :obj:`class_var` or checked against it, 
     112        if :obj:`class_var` is given as an argument.  
     113         
     114        :param class_var: Class variable that the classifier predicts. 
     115        :param default_val: Value that is returned by the classifier. 
     116        :param default_distribution: Class probabilities returned by the classifier. 
     117        
     118    .. method:: __call__(instances, return_type) 
     119         
     120        ConstantClassifier always returns the same prediction 
     121        (:obj:`default_val` and/or :obj:`default_distribution`), regardless 
     122        of the given data instance. 
     123 
     124    :obj:`ConstantClassifier` also has the following attributes, which 
     125    correspond to the constructor arguments described above. 
     126 
     127    .. attribute:: class_var 
     128    .. attribute:: default_val 
     129    .. attribute:: default_distribution 
     130 
Note: See TracChangeset for help on using the changeset viewer.