Changeset 7779:df98137d0ee2 in orange for orange/orngImpute.py


Ignore:
Timestamp:
03/23/11 16:46:55 (3 years ago)
Author:
markotoplak
Branch:
default
Convert:
efd44441c494c72bce23ffbb5502695b5796f3fb
Message:

orngImpute uses Ales's scripts.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orange/orngImpute.py

    r7764 r7779  
    1 #FOR COMPATIBILITY (orange 2.5) 
    2 import orange 
     1import Orange 
     2from Orange.feature.imputation import * 
    33 
    4 class ImputeLearner(orange.Learner): 
    5     def __new__(cls, examples = None, weightID = 0, **keyw): 
    6         self = orange.Learner.__new__(cls, **keyw) 
    7         self.dontImputeClassifier = False 
    8         self.__dict__.update(keyw) 
    9         if examples: 
    10             return self.__call__(examples, weightID) 
    11         else: 
    12             return self 
    13          
    14     def __call__(self, data, weight=0): 
    15         trained_imputer = self.imputerConstructor(data, weight) 
    16         imputed_data = trained_imputer(data, weight) 
    17         baseClassifier = self.baseLearner(imputed_data, weight) 
    18         if self.dontImputeClassifier: 
    19             return baseClassifier 
    20         else: 
    21             return ImputeClassifier(baseClassifier, trained_imputer) 
     4ImputeLearner = Orange.misc.deprecated_members( 
     5  { 
     6      "dontImputeClassifier": "dont_impute_classifier", 
     7      "imputerConstructor": "imputer_constructor", 
     8      "baseLearner": "base_learner" 
     9  })(ImputeLearner) 
    2210 
    23 class ImputeClassifier(orange.Classifier): 
    24     def __init__(self, baseClassifier, imputer, **argkw): 
    25         self.baseClassifier = baseClassifier 
    26         self.imputer = imputer 
    27         self.__dict__.update(argkw) 
    28  
    29     def __call__(self, ex, what=orange.GetValue): 
    30         return self.baseClassifier(self.imputer(ex), what) 
     11ImputeClassifier = Orange.misc.deprecated_members( 
     12  { 
     13      "baseClassifier": "base_classifier" 
     14  })(ImputeClassifier) 
Note: See TracChangeset for help on using the changeset viewer.