Ignore:
Location:
docs/reference/rst
Files:
2 edited

Legend:

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

    r9708 r9735  
    5656              tuple with both 
    5757 
    58 You can often program learners and classifiers as classes or functions 
    59 written entirely in Python and independent from Orange, as shown in 
    60 Orange for Beginners. Such classes can participate, for instance, in 
    61 the common evaluation functions like those available in modules orngTest 
    62 and orngStat. 
     58You can often program learners and classifiers as classes or functions written 
     59entirely in Python and independent from Orange. Such classes can participate, 
     60for instance, in the common evaluation functions like those available in 
     61modules :obj:`Orange.evaluation.testing` and :obj:`Orange.evaluation.scoring`. 
    6362 
    6463On the other hand, these classes can't be used as components for pure C++ 
    65 classes. For instance, TreeLearner's attribute nodeLearner should contain 
    66 a (wrapped) C++ object derived from Learner, such as MajorityLearner 
    67 or BayesLearner, and Variables's getValueFrom can only store classes 
    68 derived from Classifier, like for instance ClassifierFromVar. They cannot 
    69 accommodate Python's classes or even functions. 
     64classes. For instance, :obj:`Orange.classification.tree.TreeLearner`'s 
     65attribute nodeLearner should contain a (wrapped) C++ object derived from 
     66:obj:`Learner`, such as :obj:`Orange.classification.majority.MajorityLearner` 
     67or :obj:`Orange.classification.bayes.NaiveLearner`. They cannot accommodate 
     68Python's classes or even functions. 
    7069 
    71 There's a workaround, though. You can subtype Orange classes Learner 
    72 or Classifier as if the two classes were defined in Python, but later 
    73 use your derived Python classes as if they were written in Orange's 
    74 core. That is, you can define your class in a Python script like this: 
     70There'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 
     72derived Python classes as if they were written in Orange's core. That is, you 
     73can define your class in a Python script like this:: 
    7574 
    76     class MyLearner(orange.Learner):  
     75    class MyLearner(Orange.classifier.Learner):  
    7776        def __call__(self, examples, weightID = 0):  
    7877            <do something smart here> 
     
    8079Such a learner can then be used as any regular learner written in 
    8180Orange. You can, for instance, construct a tree learner and use your 
    82 learner to learn node classifier: 
     81learner to learn node classifier:: 
    8382 
    84     treeLearner = orange.TreeLearner() 
     83    treeLearner = Orange.classification.tree.TreeLearner() 
    8584    treeLearner.nodeLearner = MyLearner() 
    8685 
    87 If your learner or classifier is simple enough, you even don't need 
    88 to derive a class yourself. You can define the learner or classifier 
    89 as an ordinary Python function and assign it to an attribute of Orange 
    90 class that would expect a Learner or a Classifier. Wrapping into a class 
    91 derived from Learner or Classifier is done by Orange. ::  
    92  
    93     def myLearner(examples, weightID = 0):  
    94         <do something less smart here> 
    95      
    96     treeLearner = orange.TreeLearner() 
    97     treeLearner.nodeLearner = myLearner 
    98  
    99 Finally, if your learner is really simple (that is, trivial :-), you 
    100 can even stuff it into a lambda function. :: 
    101  
    102     treeLearner = orange.TreeLearner() 
    103     treeLearner.nodeLearner = lambda examples, weightID = 0: <do something trivial> 
    104  
    105 Detailed description of the mechanisms involved and example scripts are 
    106 given in a separate documentation on subtyping Orange classes in Python. 
     86----- 
    10787 
    10888Orange contains implementations of various classifiers that are described in 
  • docs/reference/rst/conf.py

    r9708 r9735  
    255255 
    256256# Example configuration for intersphinx: refer to the Python standard library. 
    257 intersphinx_mapping = {'http://docs.python.org/': None, '../tutorial': None} 
     257intersphinx_mapping = {'http://docs.python.org/': None} 
    258258 
    259259import types 
Note: See TracChangeset for help on using the changeset viewer.