Changeset 7216:7f6033aa2dd1 in orange


Ignore:
Timestamp:
02/02/11 18:09:56 (3 years ago)
Author:
tomazc <tomaz.curk@…>
Branch:
default
Convert:
8bfffd3158bfa13ec353963ef6993bc1a509ac1c
Message:
 
Location:
orange/Orange/feature
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • orange/Orange/feature/continuization.py

    r7199 r7216  
     1from Orange.core import DomainContinuizer 
  • orange/Orange/feature/discretization.py

    r7199 r7216  
    11import Orange.core as orange 
     2 
     3from Orange.core import \ 
     4    Discrete2Continuous, \ 
     5    Discretizer, \ 
     6        BiModalDiscretizer, \ 
     7        EquiDistDiscretizer, \ 
     8        IntervalDiscretizer, \ 
     9        ThresholdDiscretizer 
    210 
    311###### 
  • orange/Orange/feature/imputation.py

    r7199 r7216  
     1import Orange.core as orange 
     2 
     3class ImputeLearner(orange.Learner): 
     4    def __new__(cls, examples = None, weightID = 0, **keyw): 
     5        self = orange.Learner.__new__(cls, **keyw) 
     6        self.dontImputeClassifier = False 
     7        self.__dict__.update(keyw) 
     8        if examples: 
     9            return self.__call__(examples, weightID) 
     10        else: 
     11            return self 
     12         
     13    def __call__(self, data, weight=0): 
     14        trained_imputer = self.imputerConstructor(data, weight) 
     15        imputed_data = trained_imputer(data, weight) 
     16        baseClassifier = self.baseLearner(imputed_data, weight) 
     17        if self.dontImputeClassifier: 
     18            return baseClassifier 
     19        else: 
     20            return ImputeClassifier(baseClassifier, trained_imputer) 
     21 
     22class ImputeClassifier(orange.Classifier): 
     23    def __init__(self, baseClassifier, imputer, **argkw): 
     24        self.baseClassifier = baseClassifier 
     25        self.imputer = imputer 
     26        self.__dict__.update(argkw) 
     27 
     28    def __call__(self, ex, what=orange.GetValue): 
     29        return self.baseClassifier(self.imputer(ex), what) 
Note: See TracChangeset for help on using the changeset viewer.