Ignore:
Timestamp:
03/19/13 19:36:52 (13 months ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
Message:

Fixes for Widgets Development documentation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • docs/extend-widgets/rst/channels.rst

    r11050 r11408  
    5151 
    5252    self.inputs = [("Data", ExampleTable, self.dataset), 
    53                ("Learner", orange.Learner, self.learner, Multiple)] 
     53                   ("Learner", orange.Learner, self.learner, Multiple + Default)] 
    5454 
    5555Notice that everything is pretty much the same as it was with 
     
    6363channel for its type (more on default channels later). 
    6464 
     65.. note:: :obj:`Default` flag here is used for illustration. Since *Learner* 
     66          channel is the only channel for a :class:`orange.Learner` type 
     67          it is also the default. 
     68 
    6569How does the widget know from which widget did the token come from? 
    6670In Orange, tokens are sent around with an id of a widget that is 
    67 sending the token (essentially, with a pointer to the corresponding 
    68 widget object), and having a multi-input channel only tells Orange to 
     71sending the token, and having a multi-input channel only tells Orange to 
    6972send a token together with sending widget id, the two arguments with 
    7073which the receiving function is called. For our :obj:`Learner` 
     
    146149all that is needed is the augmenting the list :: 
    147150 
    148     self.scoring = [("Classification Accuracy", orngStat.CA),\ 
    149                 ("AUC", orngStat.AUC), \ 
    150                 ("BrierScore", orngStat.BrierScore),\ 
    151                 ("Information Score", orngStat.IS),\ 
    152                 ("Sensitivity", orngStat.sens), \ 
    153                 ("Specificity", orngStat.spec)] 
     151    self.scoring = [("Classification Accuracy", orngStat.CA), 
     152                    ("AUC", orngStat.AUC), 
     153                    ("BrierScore", orngStat.BrierScore), 
     154                    ("Information Score", orngStat.IS), 
     155                    ("Sensitivity", orngStat.sens), 
     156                    ("Specificity", orngStat.spec)] 
    154157 
    155158which is defined in the initialization part of the widget. The 
     
    160163essentially means that switching from one to another scoring function 
    161164(and displaying the result in the table) takes only a split of a 
    162 second. To see the rest of the widget, check out `its code <OWLearningCurveA.py>`_. 
     165second. To see the rest of the widget, check out 
     166:download:`its code <OWLearningCurveA.py>`. 
    163167 
    164168***************************** 
     
    176180    self.outputs = [("Sampled Data", ExampleTable), ("Other Data", ExampleTable)] 
    177181 
    178 We used this in the third incarnation of `data sampler widget <OWDataSamplerC.py>`_, 
     182We used this in the third incarnation of :download:`data sampler widget <OWDataSamplerC.py>`, 
    179183with essentially the only other change in the code in the :obj:`selection` and 
    180184:obj:`commit` functions:: 
     
    221225When enlisting the input channel of the same type, the non-default 
    222226channels have a special flag in the channel specification list. So for 
    223 our new `learning curve <OWLearningCurveB.py>`_ widget, the 
     227our new :download:`learning curve <OWLearningCurveB.py>` widget, the 
    224228channel specification is:: 
    225229 
    226230    self.inputs = [("Train Data", ExampleTable, self.trainset, Default), 
    227                ("Test Data", ExampleTable, self.testset), 
    228                ("Learner", orange.Learner, self.learner, Multiple)] 
     231                   ("Test Data", ExampleTable, self.testset), 
     232                   ("Learner", orange.Learner, self.learner, Multiple)] 
    229233 
    230234That is, the :obj:`Train Data` channel is a single-token 
    231235channel which is a default one (third parameter). Note that the flags can 
    232 be added (or OR-d) together so :obj:`Default + Multi` is a valid flag. 
     236be added (or OR-d) together so :obj:`Default + Multiple` is a valid flag. 
    233237To test how this works, connect a file widget to a learning curve widget and 
    234238- nothing will really happen: 
Note: See TracChangeset for help on using the changeset viewer.