Changeset 10264:273260f0e2c5 in orange


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

Polished documentation for Orange.classification

Location:
docs/reference/rst
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • docs/reference/rst/Orange.classification.rst

    r10246 r10264  
    55################################### 
    66 
    7 Induction of models in Orange is implemented through a two-class schema: 
    8 "learners" are classes that induce models, and classifiers represent 
    9 trained models. The learner holds the parameters that 
    10 are used for fitting the model. When learner is called with a data table, 
    11 it fits a model and returns an instance of classifier. Classifiers can be subsequently used to predict dependent values for new data instances. 
     7Induction of models in Orange is implemented through a two-class 
     8schema. A learning algorithm is represented as an instance of a class 
     9derived from :obj:`Orange.classification.Learner`. The learner stores 
     10all parameters of the learning algorithm. When a learner is called 
     11with some data, it fits a model of the kind specific to the learning 
     12algorithm and returns it as a (new) instance of a class derived 
     13:obj:`Orange.classification.Classifier` that holds parameters of the model. 
    1214 
    1315.. literalinclude:: code/bayes-run.py 
     
    3335------------ 
    3436 
    35 All learners and classifiers, including regressors, are derived from the following two clases. 
     37All learning algorithms and prediction models are derived from the following two clases. 
    3638 
    3739.. class:: Learner() 
    3840 
    39     Base class for all orange learners. 
     41    Abstract base class for learning algorithms. 
    4042 
    4143    .. method:: __call__(data) 
    4244 
    43         Fit a model and return it as an instance of :class:`Classifier`. 
     45        An abstract method that fits a model and returns it as an 
     46        instance of :class:`Classifier`. 
    4447 
    45         This method is abstract and needs to be implemented on each learner. 
    4648 
    4749.. class:: Classifier() 
    4850 
    49     Base class for all orange classifiers. 
     51    Abstract base class for prediction models (both classifiers and regressors). 
    5052 
    5153    .. method:: __call__(instance, return_type=GetValue) 
     
    6668        Return a tuple of target class value and probabilities for each class. 
    6769 
    68         This method is abstract and needs to be implemented on each 
    69         classifier. 
    70  
     70         
    7171        :param instance: data instance to be classified. 
    7272        :type instance: :class:`~Orange.data.Instance` 
     
    8585------------------- 
    8686 
    87 The classification module also contains a classifier that always predicts a 
    88 constant value regardless of given data instances. It is usually not used 
    89 directly but through other other learners and methods, such as 
    90 :obj:`~Orange.classification.majority.MajorityLearner`. 
     87The classification module also contains a classifier that always 
     88predicts a constant value regardless of given data instances. This 
     89classifier is constructed by different learners such as 
     90:obj:`~Orange.classification.majority.MajorityLearner`, and by some other 
     91methods. 
    9192 
    9293.. class:: ConstantClassifier 
    9394 
    94     ConstantClassifier always classifies to the same class and reports the 
    95     same class probabilities. 
     95    Predict the specified ``default_val`` or ``default_distribution`` 
     96    for any instance. 
    9697 
    9798    .. attribute:: class_var 
     
    101102    .. attribute:: default_val 
    102103 
    103         Value returned by the classifier. 
     104        The value returned by the classifier. 
    104105 
    105106    .. attribute:: default_distribution 
     
    125126        :type dstribution: :obj:`Orange.statistics.distribution.Distribution` 
    126127        
    127     .. method:: __call__(data, return_type) 
     128    .. method:: __call__(instance, return_type) 
    128129         
    129         ConstantClassifier always returns the same prediction 
    130         (:obj:`default_val` and/or :obj:`default_distribution`), regardless 
    131         of the given data instance. 
     130        Return :obj:`default_val` and/or :obj:`default_distribution` 
     131        (depending upon :obj:`return_type`) disregarding the 
     132        :obj:`instance`. 
    132133 
    133134 
  • docs/reference/rst/code/bayes-run.py

    r9372 r10264  
    1111classifier = learner(titanic) 
    1212 
    13 for ex in titanic[:5]: 
    14     print ex.getclass(), classifier(ex) 
     13for inst in titanic[:5]: 
     14    print inst.getclass(), classifier(inst) 
Note: See TracChangeset for help on using the changeset viewer.