Changeset 11455:ea4f1b23ca68 in orange
 Timestamp:
 04/15/13 12:15:40 (12 months ago)
 Branch:
 default
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

Orange/OrangeWidgets/Regression/OWEarth.py
r11217 r11455 14 14 from Orange.regression import earth 15 15 from orngWrap import PreprocessedLearner 16 16 17 17 18 class OWEarth(OWWidget): 18 19 settingsList = ["name", "degree", "terms", "penalty"] … … 20 21 def __init__(self, parent=None, signalManager=None, 21 22 title="Earth"): 22 OWWidget.__init__(self, parent, signalManager, title, wantMainArea=False) 23 OWWidget.__init__(self, parent, signalManager, title, 24 wantMainArea=False) 23 25 24 26 self.inputs = [("Data", Orange.data.Table, self.set_data), 25 ("Preprocessor", PreprocessedLearner, self.set_preprocessor)] 27 ("Preprocessor", PreprocessedLearner, 28 self.set_preprocessor)] 26 29 27 30 self.outputs = [("Learner", earth.EarthLearner, Default), … … 40 43 ##### 41 44 42 OWGUI.lineEdit(self.controlArea, self, "name", 45 OWGUI.lineEdit(self.controlArea, self, "name", 43 46 box="Learner/Classifier Name", 44 47 tooltip="Name for the learner/predictor") … … 46 49 box = OWGUI.widgetBox(self.controlArea, "Forward Pass", addSpace=True) 47 50 OWGUI.spin(box, self, "degree", 1, 3, step=1, 48 label="Max. term degree", 49 tooltip="Maximum degree of the terms derived (number of hinge functions).") 51 label="Max. term degree", 52 tooltip="Maximum degree of the terms derived " 53 "(number of hinge functions).") 50 54 s = OWGUI.spin(box, self, "terms", 1, 200, step=1, 51 55 label="Max. terms", 52 tooltip="Maximum number of terms derived in the forward pass.") 56 tooltip="Maximum number of terms derived in the " 57 "forward pass.") 53 58 s.control.setSpecialValueText("Automatic") 54 59 … … 76 81 77 82 def apply(self): 78 learner = earth.EarthLearner(degree=self.degree, 79 terms=self.terms if self.terms >= 2 else None, 80 penalty=self.penalty, 81 name=self.name) 83 learner = earth.EarthLearner( 84 degree=self.degree, 85 terms=self.terms if self.terms >= 2 else None, 86 penalty=self.penalty, 87 name=self.name) 88 82 89 predictor = None 83 90 basis_matrix = None … … 93 100 self.error(0, "An error during learning: %r" % ex) 94 101 95 if predictor is not None: 102 if predictor is not None: 96 103 base_features = predictor.base_features() 97 basis_domain = Orange.data.Domain(base_features, 98 self.data.domain.class_var) 104 basis_domain = Orange.data.Domain( 105 base_features, 106 self.data.domain.class_var, 107 self.data.domain.class_vars) 108 basis_domain.add_metas(self.data.domain.get_metas()) 99 109 basis_matrix = Orange.data.Table(basis_domain, self.data) 100 110 … … 104 114 105 115 def sendReport(self): 106 self.reportSettings("Learning parameters", 107 [("Degree", self.degree), 108 ("Terms", self.terms if self.terms >= 2 else "Automatic"), 109 ("Knot penalty", "%.2f" % self.penalty) 110 ]) 116 self.reportSettings( 117 "Learning parameters", 118 [("Degree", self.degree), 119 ("Terms", self.terms if self.terms >= 2 else "Automatic"), 120 ("Knot penalty", "%.2f" % self.penalty) 121 ]) 122 111 123 self.reportData(self.data) 112 124
Note: See TracChangeset
for help on using the changeset viewer.