Changeset 9205:cc8a9c2bd0bf in orange
- Timestamp:
- 11/14/11 16:14:57 (18 months ago)
- Branch:
- default
- Convert:
- 3716040913f250d3c0d2714eaecda5638242cd8e
- File:
-
- 1 edited
-
orange/Orange/regression/earth.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
orange/Orange/regression/earth.py
r9114 r9205 229 229 expanded_class=expanded_class) 230 230 231 232 def soft_max(values): 233 values = numpy.asarray(values) 234 return numpy.exp(values) / numpy.sum(numpy.exp(values)) 235 231 236 232 237 class EarthClassifier(Orange.core.ClassifierFD): … … 267 272 from Orange.statistics.distribution import Distribution 268 273 269 if is_discrete(self.class_var): 270 winner = max(vals) #TODO: Handle ties. 271 value = winner.variable.get_value_from.transformer.value 272 value = self.class_var(value) 274 if not self.multi_flag and is_discrete(self.class_var): 273 275 dist = Distribution(self.class_var) 274 dist[value] = 1.0 276 if len(self.class_var.values) == 2: 277 probs = [1 - float(vals[0]), float(vals[0])] 278 else: 279 probs = soft_max(map(float, vals)) 280 281 for val, p in zip(self.class_var.values, probs): 282 dist[val] = p 283 value = dist.modus() 275 284 vals, probs = [value], [dist] 276 285 else:
Note: See TracChangeset
for help on using the changeset viewer.
