Ignore:
File:
1 edited

Legend:

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

    r9754 r9820  
    55################################### 
    66 
    7 All classifiers in Orange consist of two parts, a Learner and a Classifier. A 
    8 learner is constructed with all parameters that will be used for learning. 
    9 When a data table is passed to its __call__ method, a model is fitted to the 
    10 data and return in a form of a Classifier, which is then used for predicting 
    11 the dependent variable(s) of new instances. 
     7To facilitate correct evaluation, all classifiers in Orange consist of two 
     8parts, a Learner and a Classifier. A learner is constructed with all 
     9parameters 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 
     11Classifier, which is then used for predicting the dependent variable(s) of 
     12new instances. 
    1213 
    1314.. class:: Learner() 
     
    5657              tuple with both 
    5758 
    58 You can often program learners and classifiers as classes or functions written 
    59 entirely in Python and independent from Orange. Such classes can participate, 
    60 for instance, in the common evaluation functions like those available in 
    61 modules :obj:`Orange.evaluation.testing` and :obj:`Orange.evaluation.scoring`. 
    6259 
    63 On the other hand, these classes can't be used as components for pure C++ 
    64 classes. For instance, :obj:`Orange.classification.tree.TreeLearner`'s 
    65 attribute nodeLearner should contain a (wrapped) C++ object derived from 
    66 :obj:`Learner`, such as :obj:`Orange.classification.majority.MajorityLearner` 
    67 or :obj:`Orange.classification.bayes.NaiveLearner`. They cannot accommodate 
    68 Python's classes or even functions. 
     60When developing new prediction models, one should extend :obj:`Learner` and 
     61:obj:`Classifier`\. Code that infers the model from the data should be placed 
     62in Learners's :obj:`~Learner.__call__` method. This method should 
     63return a :obj:`Classifier`. Classifiers' :obj:`~Classifier.__call__` method 
     64should  return the predicition; :class:`~Orange.data.Value`, 
     65:class:`~Orange.statistics.distribution.Distribution` or a tuple with both 
     66based on the value of the parameter :obj:`return_type`. 
    6967 
    70 There's a workaround, though. You can subtype Orange classes :obj:`Learner` or 
    71 :obj:`Classifier` as if the two classes were defined in Python, but later use your 
    72 derived Python classes as if they were written in Orange's core. That is, you 
    73 can define your class in a Python script like this:: 
    74  
    75     class MyLearner(Orange.classifier.Learner):  
    76         def __call__(self, examples, weightID = 0):  
    77             <do something smart here> 
    78  
    79 Such a learner can then be used as any regular learner written in 
    80 Orange. You can, for instance, construct a tree learner and use your 
    81 learner to learn node classifier:: 
    82  
    83     treeLearner = Orange.classification.tree.TreeLearner() 
    84     treeLearner.nodeLearner = MyLearner() 
    85  
    86 ----- 
    87  
    88 Orange contains implementations of various classifiers that are described in 
    89 detail on separate pages. 
     68Orange implements various classifiers that are described in detail on 
     69separate pages. 
    9070 
    9171.. toctree:: 
Note: See TracChangeset for help on using the changeset viewer.