Changeset 9485:022e858d9608 in orange


Ignore:
Timestamp:
08/19/11 09:29:35 (3 years ago)
Author:
wencanluo <wencanluo@…>
Branch:
default
Convert:
30d4dfdd65cb9940e38e2b0c9a6613d8d4b0e820
Message:

Add "smooth" parameter control for ML-kNN widget

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orange/OrangeWidgets/Multilabel/OWMLkNN.py

    r9476 r9485  
    1515 
    1616class OWMLkNN(OWWidget): 
    17     settingsList = ["name","k"] 
     17    settingsList = ["name", "k", "smooth"] 
    1818 
    1919    def __init__(self, parent=None, signalManager = None, name='ML-kNN'): 
     
    3030        self.name = 'ML-kNN' 
    3131        self.k = 1 
     32        self.smooth = 1.0 
    3233         
    3334        self.loadSettings() 
     
    4647        OWGUI.spin(wbN, self, "k", 1, 100, 1, None, "Number of neighbours", orientation="horizontal") 
    4748         
     49        OWGUI.separator(self.controlArea) 
     50        OWGUI.widgetLabel(self.controlArea, 'Smoothing parameter') 
     51        kernelSizeValid = QDoubleValidator(self.controlArea) 
     52        kernelSizeValid.setRange(0,10,3) 
     53        OWGUI.lineEdit(self.controlArea, self, 'smooth', 
     54                       tooltip='Smoothing parameter controlling the strength of uniform prior (Default value is set to 1 which yields the Laplace smoothing).', 
     55                       valueType = float, validator = kernelSizeValid) 
     56                        
    4857        OWGUI.separator(self.controlArea) 
    4958 
     
    7483          
    7584    def set_learner(self): 
    76         self.learner = Orange.multilabel.MLkNNLearner(k = self.k) 
     85        self.learner = Orange.multilabel.MLkNNLearner(k = self.k, smooth = self.smooth) 
    7786        if self.preprocessor: 
    7887            self.learner = self.preprocessor.wrapLearner(self.learner) 
Note: See TracChangeset for help on using the changeset viewer.