Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • docs/extend-widgets/rst/OWDataSamplerB.py

    r11085 r11593  
    22<name>Data Sampler (B)</name> 
    33<description>Randomly selects a subset of instances from the data set</description> 
    4 <icon>icons/DataSamplerB.png</icon> 
     4<icon>icons/DataSamplerB.svg</icon> 
    55<priority>20</priority> 
    66""" 
     7import Orange 
    78from OWWidget import * 
    89import OWGUI 
     
    1112    settingsList = ['proportion', 'commitOnChange'] 
    1213    def __init__(self, parent=None, signalManager=None): 
    13         OWWidget.__init__(self, parent, signalManager, 'SampleDataB') 
     14        OWWidget.__init__(self, parent, signalManager) 
    1415 
    15         self.inputs = [("Data", ExampleTable, self.data)] 
    16         self.outputs = [("Sampled Data", ExampleTable)] 
     16        self.inputs = [("Data", Orange.data.Table, self.data)] 
     17        self.outputs = [("Sampled Data", Orange.data.Table)] 
    1718 
    1819        self.proportion = 50 
     
    4950 
    5051    def selection(self): 
    51         indices = orange.MakeRandomIndices2(p0=self.proportion / 100.) 
     52        indices = Orange.data.sample.SubsetIndices2(p0=self.proportion / 100.) 
    5253        ind = indices(self.dataset) 
    5354        self.sample = self.dataset.select(ind, 0) 
     
    6162            self.commit() 
    6263 
    63 ############################################################################## 
    64 # Test the widget, run from prompt 
    6564 
    6665if __name__=="__main__": 
     
    6867    ow = OWDataSamplerB() 
    6968    ow.show() 
    70     dataset = orange.ExampleTable('iris.tab') 
     69    dataset = Orange.data.Table('iris.tab') 
    7170    ow.data(dataset) 
    7271    appl.exec_() 
Note: See TracChangeset for help on using the changeset viewer.