Changeset 11765:1546cd04481b in orange for Orange/OrangeWidgets/Classify/OWCN2.py
 Timestamp:
 11/14/13 15:43:58 (5 months ago)
 Branch:
 default
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

Orange/OrangeWidgets/Classify/OWCN2.py
r11287 r11765 65 65 callbackDeposit=[] 66 66 def __init__(self, parent=None, signalManager=None): 67 OWWidget.__init__(self,parent,signalManager,"CN2", wantMainArea = 0, resizingEnabled = 0) 67 OWWidget.__init__(self, parent, signalManager,"CN2", 68 wantMainArea=False, resizingEnabled=False) 68 69 69 70 self.inputs = [("Data", ExampleTable, self.dataset), ("Preprocess", PreprocessedLearner, self.setPreprocessor)] … … 104 105 self.coveringAlgBG.buttons = [] 105 106 106 """ 107 self.ruleQualityBG=OWGUI.radioButtonsInBox(self.ruleQualityGroup, self, "QualityButton", 108 btnLabels=["Laplace","mestimate","WRACC"], 109 box="Rule quality", callback=self.qualityButtonPressed, 110 tooltips=["Laplace rule evaluator", "mestimate rule evaluator", 111 "WRACC rule evaluator"]) 112 self.mSpin=Spin=OWGUI.spin(self.ruleQualityGroup, self, "m", 0, 100, label="m", 113 orientation="horizontal", labelWidth=labelWidth100, tooltip="m value for m estimate rule evaluator") 114 """ 115 116 b1 = QRadioButton("Laplace", self.ruleQualityBG); self.ruleQualityBG.layout().addWidget(b1) 117 g = OWGUI.widgetBox(self.ruleQualityBG, orientation = "horizontal"); 107 b1 = QRadioButton("Laplace", self.ruleQualityBG) 108 self.ruleQualityBG.layout().addWidget(b1) 109 g = OWGUI.widgetBox(self.ruleQualityBG, orientation="horizontal") 118 110 b2 = QRadioButton("mestimate", g) 119 111 g.layout().addWidget(b2) … … 128 120 self.connect(button, SIGNAL("clicked()"), lambda v=i: self.qualityButtonPressed(v)) 129 121 130 OWGUI.doubleSpin(self.ruleValidationGroup, self, "Alpha", 0, 1,0.001, label="Alpha (vs. default rule)", 131 orientation="horizontal", labelWidth=labelWidth, 132 tooltip="Required significance of the difference between the class distribution on all example and covered examples") 133 OWGUI.doubleSpin(self.ruleValidationGroup, self, "stepAlpha", 0, 1,0.001, label="Stopping Alpha (vs. parent rule)", 134 orientation="horizontal", labelWidth=labelWidth, 135 tooltip="Required significance of each specialization of a rule.") 136 OWGUI.spin(self.ruleValidationGroup, self, "MinCoverage", 0, 100,label="Minimum coverage", 137 orientation="horizontal", labelWidth=labelWidth, tooltip= 138 "Minimum number of examples a rule must\ncover (use 0 for not setting the limit)") 139 OWGUI.checkWithSpin(self.ruleValidationGroup, self, "Maximal rule length", 0, 100, "useMaxRuleLength", "MaxRuleLength", labelWidth=labelWidth, 140 tooltip="Maximal number of conditions in the left\npart of the rule (use 0 for don't care)") 141 142 """ 143 self.coveringAlgBG=OWGUI.radioButtonsInBox(self.coveringAlgGroup, self, "CoveringButton", 144 btnLabels=["Exclusive covering ","Weighted Covering"], 145 tooltips=["Each example will only be used once\n for the construction of a rule", 146 "Examples can take part in the construction\n of many rules(CN2SD Algorithm)"], 147 box="Covering algorithm", callback=self.coveringAlgButtonPressed) 148 self.weightSpin=OWGUI.doubleSpin(self.coveringAlgGroup, self, "Weight",0, 0.95,0.05,label= "Weight", 149 orientation="horizontal", labelWidth=labelWidth, tooltip= 150 "Multiplication constant by which the weight of\nthe example will be reduced") 151 """ 152 153 B1 = QRadioButton("Exclusive covering", self.coveringAlgBG); self.coveringAlgBG.layout().addWidget(B1) 154 g = OWGUI.widgetBox(self.coveringAlgBG, orientation = "horizontal") 155 B2 = QRadioButton("Weighted covering", g); g.layout().addWidget(B2) 122 form = QFormLayout( 123 labelAlignment=Qt.AlignLeft, formAlignment=Qt.AlignLeft, 124 fieldGrowthPolicy=QFormLayout.AllNonFixedFieldsGrow 125 ) 126 127 self.ruleValidationGroup.layout().addLayout(form) 128 129 alpha_spin = OWGUI.doubleSpin( 130 self.ruleValidationGroup, self, "Alpha", 0, 1, 0.001, 131 tooltip="Required significance of the difference between the " + 132 "class distribution on all examples and covered examples") 133 134 step_alpha_spin = OWGUI.doubleSpin( 135 self.ruleValidationGroup, self, "stepAlpha", 0, 1, 0.001, 136 tooltip="Required significance of each specialization of a rule.") 137 138 min_coverage_spin = OWGUI.spin( 139 self.ruleValidationGroup, self, "MinCoverage", 0, 100, 140 tooltip="Minimum number of examples a rule must cover " + 141 "(use 0 for not setting the limit)") 142 143 min_coverage_spin.setSpecialValueText("Unlimited") 144 145 # Check box needs to be in alayout for the form layout to center it 146 # in the vertical direction. 147 max_rule_box = OWGUI.widgetBox(self.ruleValidationGroup, "") 148 max_rule_cb = OWGUI.checkBox( 149 max_rule_box, self, "useMaxRuleLength", "Maximal rule length") 150 151 max_rule_spin = OWGUI.spin( 152 self.ruleValidationGroup, self, "MaxRuleLength", 0, 100, 153 tooltip="Maximal number of conditions in the left\n" + 154 "part of the rule (use 0 for don't care)") 155 max_rule_spin.setSpecialValueText("Unlimited") 156 max_rule_cb.disables += [max_rule_spin] 157 max_rule_cb.makeConsistent() 158 159 form.addRow("Alpha (vs. default rule)", alpha_spin) 160 form.addRow("Stopping Alpha (vs. parent rule)", step_alpha_spin) 161 form.addRow("Minimum coverage", min_coverage_spin) 162 form.addRow(max_rule_box, max_rule_spin) 163 164 B1 = QRadioButton("Exclusive covering", self.coveringAlgBG) 165 self.coveringAlgBG.layout().addWidget(B1) 166 g = OWGUI.widgetBox(self.coveringAlgBG, orientation="horizontal") 167 B2 = QRadioButton("Weighted covering", g) 168 g.layout().addWidget(B2) 156 169 self.coveringAlgBG.buttons = [B1, B2] 157 170 self.weightSpin=OWGUI.doubleSpin(g,self,"Weight",0,0.95,0.05)
Note: See TracChangeset
for help on using the changeset viewer.