Changeset 10997:e82a939c44ce in orange


Ignore:
Timestamp:
10/15/12 12:30:11 (18 months ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
Message:

Updated channel specification flags documentation in 'extend-widgets'.

Location:
Orange/doc/extend-widgets
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • Orange/doc/extend-widgets/OWLearningCurveA.py

    r9671 r10997  
    1515        OWWidget.__init__(self, parent, signalManager, 'LearningCurveA') 
    1616 
    17         self.inputs = [("Data", ExampleTable, self.dataset), ("Learner", orange.Learner, self.learner, 0)] 
     17        self.inputs = [("Data", ExampleTable, self.dataset), 
     18                       ("Learner", orange.Learner, self.learner, Multiple)] 
    1819         
    1920        self.folds = 5     # cross validation folds 
  • Orange/doc/extend-widgets/OWLearningCurveB.py

    r9671 r10997  
    1515        OWWidget.__init__(self, parent, signalManager, 'LearningCurveA') 
    1616 
    17         self.inputs = [("Train Data", ExampleTable, self.trainset), ("Test Data", ExampleTable, self.testset, 1, 1), ("Learner", orange.Learner, self.learner, 0)] 
     17        self.inputs = [("Train Data", ExampleTable, self.trainset, Default), 
     18                       ("Test Data", ExampleTable, self.testset), 
     19                       ("Learner", orange.Learner, self.learner, Multiple)] 
    1820         
    1921        self.folds = 5     # cross validation folds 
  • Orange/doc/extend-widgets/OWLearningCurveC.py

    r9671 r10997  
    2020        OWWidget.__init__(self, parent, signalManager, 'LearningCurveC') 
    2121 
    22         self.inputs = [("Data", ExampleTable, self.dataset), ("Learner", orange.Learner, self.learner, 0)] 
     22        self.inputs = [("Data", ExampleTable, self.dataset), 
     23                       ("Learner", orange.Learner, self.learner, Multiple)] 
    2324 
    2425        self.folds = 5     # cross validation folds 
  • Orange/doc/extend-widgets/OWLearningCurve_plot.py

    r9671 r10997  
    2020        OWWidget.__init__(self, parent, signalManager, 'LearningCurveC') 
    2121 
    22         self.inputs = [("Data", ExampleTable, self.dataset), ("Learner", orange.Learner, self.learner, 0)] 
     22        self.inputs = [("Data", ExampleTable, self.dataset), 
     23                       ("Learner", orange.Learner, self.learner, Multiple)] 
    2324 
    2425        self.folds = 5     # cross validation folds 
  • Orange/doc/extend-widgets/api.htm

    r9671 r10997  
    9191input channel in the following way:</p> 
    9292 
    93 <xmp class="code">self.inputs = [("Learners", orange.Learner, self.learner, 0)] 
     93<xmp class="code">self.inputs = [("Learners", orange.Learner, self.learner, Multiple)] 
    9494</xmp> 
    9595 
    96 <p>where the last argument refers if we have a "single token channel" 
    97 (last argument should be 1, default) or a "multitoken" one (0 as a 
    98 fourth element of the list holding channel definition). For the above 
    99 declared channel, the receiving function should include an extra 
    100 argument for the ID, like:</p> 
     96<p>where the last argument refers if we have a "Single" (default if not 
     97specified) or a "Multiple" channel. For the above declared channel, the 
     98receiving function should include an extra argument for the ID, like:</p> 
    10199 
    102100<xmp class="code">def learner(self, learnertoken, tokenid): 
     
    110108would declare input channels like:</p> 
    111109 
    112 <xmp class="code">self.inputs = [("Data", orange.ExampleTable, self.maindata), ("Additional Data", orange.ExampleTable, self.otherdata)] 
     110<xmp class="code">self.inputs = [("Data", orange.ExampleTable, self.maindata), 
     111               ("Additional Data", orange.ExampleTable, self.otherdata)] 
    113112</xmp> 
    114113 
    115114<p>and we connect this widget in Orange Canvas to a sending widget 
    116115that has a single orange.ExampleTable output channel, Canvas would 
    117 bring up Set Channels dialog. There, a sending widget's channel would 
     116bring up Set Channels dialog. There, a sending widget's channel could 
    118117be connected to both receiving channels. As we would often prefer to 
    119118connect to a single (default) channel instead (still allowing user of 
    120 Orange Canvas to set up a different schema manually), we set all the 
    121 channels to which we do not want an automatic connection into a "minor 
    122 mode". We do this by the using the fifth element in the channel 
     119Orange Canvas to set up a different schema manually), we set that channel 
     120as the default. We do this by the using the fourth element in the channel 
    123121definition list, like:</p> 
    124122 
    125 <xmp class="code">self.inputs = [("Data", orange.ExampleTable, self.maindata), 
    126 ("Additional Data", orange.ExampleTable, self.otherdata, 1, 1)] 
     123<xmp class="code">self.inputs = [("Data", orange.ExampleTable, self.maindata, Default), 
     124               ("Additional Data", orange.ExampleTable, self.otherdata)] 
    127125</xmp> 
    128126 
  • Orange/doc/extend-widgets/channels.htm

    r9671 r10997  
    5353widget are defined by:</p> 
    5454 
    55 <xmp class="code">self.inputs = [("Data", ExampleTable, self.dataset), ("Learner", orange.Learner, self.learner, 0)] 
     55<xmp class="code">self.inputs = [("Data", ExampleTable, self.dataset), 
     56               ("Learner", orange.Learner, self.learner, Multiple)] 
    5657</xmp> 
    5758 
    5859<p>Notice that everything is pretty much the same as it was with 
    59 widgets from previous lessons, the only difference being "0" as the 
    60 last value in the list that defines the <code>Learner</code> 
    61 channel. This "0" says that this is a multi-input channel. If it would 
    62 be "1" (default), it would mean that the widget can receive the input 
    63 only from one widget.</p> 
     60widgets from previous lessons, the only difference being 
     61<code>Multiple + Default</code> as the last value in the list that defines 
     62the <code>Learner</code> channel. This <code>Multiple + Default</code> says 
     63that this is a multi-input channel and is the default input for its type. 
     64If it would be unspecified then by default value of 
     65<code>Single + NonDefault</code> would be used. That would mean that the 
     66widget can receive the input only from one widget and is not the default input 
     67channel for its type (more on default channels later).</p> 
    6468 
    6569<p>How does the widget know from which widget did the token come from? 
     
    206210<img src="datasampler-totable.png"> 
    207211 
    208 <p>we would get a following window quering users for information on 
     212<p>we would get a following window querying users for information on 
    209213which channels to connect:</p> 
    210214 
     
    224228 
    225229<p>When enlisting the input channel of the same type, the non-default 
    226 channels have a special fourth value in the channel specification 
    227 list. So for our new <a href="OWLearningCurveB.py">learning curve</a> 
    228 widget, the channel specification is:</p> 
    229  
    230 <xmp class="code">self.inputs = [("Train Data", ExampleTable, self.trainset), ("Test Data", ExampleTable, self.testset, 1, 1), ("Learner", orange.Learner, self.learner, 0)] 
    231 </xmp> 
    232  
    233 <p>That is, the <code>Test Data</code> channel is a single-token 
    234 channel (third parameter) which is not a default one (where "1" 
    235 indicates that this is a so-called minor channel). To test how this 
    236 works, connect a file widget to a learning curve widget and - nothing 
    237 will really happen:</p> 
     230channels have a special flag in the channel specification list. So for 
     231our new <a href="OWLearningCurveB.py">learning curve</a> widget, the 
     232channel specification is:</p> 
     233 
     234<xmp class="code">self.inputs = [("Train Data", ExampleTable, self.trainset, Default), 
     235               ("Test Data", ExampleTable, self.testset), 
     236               ("Learner", orange.Learner, self.learner, Multiple)] 
     237</xmp> 
     238 
     239<p>That is, the <code>Train Data</code> channel is a single-token 
     240channel which is a default one (third parameter). Note that the flags can 
     241be added (or OR-d) together so <code>Default + Multi</code> is a valid flag. 
     242To test how this works, connect a file widget to a learning curve widget and 
     243- nothing will really happen:</p> 
    238244 
    239245<img src="file-to-learningcurveb.png"> 
Note: See TracChangeset for help on using the changeset viewer.