Changeset 10542:7dde0640e266 in orange


Ignore:
Timestamp:
03/15/12 15:14:54 (2 years ago)
Author:
anzeh <anze.staric@…>
Branch:
default
Message:

Moved preprocess from Orange to Orange.data.

Files:
19 edited
3 moved

Legend:

Unmodified
Added
Removed
  • Orange/OrangeWidgets/Data/OWPreprocess.py

    r9671 r10542  
    1717import math 
    1818 
    19 from Orange.preprocess import * 
     19from Orange.data import preprocess 
    2020 
    2121def _gettype(obj): 
     
    7676    def getDiscretizer(self): 
    7777        if self.discInd == 0: 
    78             preprocessor = Preprocessor_discretizeEntropy(method=orange.EntropyDiscretization()) 
     78            preprocessor = preprocess.DiscretizeEntropy(method=orange.EntropyDiscretization()) 
    7979        elif self.discInd in [1, 2]: 
    8080            name, disc, kwds = self.DISCRETIZERS[self.discInd] 
    81             preprocessor = Preprocessor_discretize(method=disc(**dict([(key, getattr(self, key, val)) for key, val in kwds.items()]))) 
     81            preprocessor = preprocess.Discretize(method=disc(**dict([(key, getattr(self, key, val)) for key, 
     82                                                                                              val in kwds.items()]))) 
    8283        elif self.discInd == 3: 
    83             preprocessor = Preprocessor_removeContinuous() 
     84            preprocessor = preprocess.RemoveContinuous() 
    8485        return preprocessor 
    8586     
     
    120121    def getContinuizer(self): 
    121122        if self.contInd in [0, 1, 2, 4, 5]: 
    122             preprocessor = Preprocessor_continuize(multinomialTreatment=self.CONTINUIZERS[self.contInd][1]) 
     123            preprocessor = preprocess.Continuize(multinomialTreatment=self.CONTINUIZERS[self.contInd][1]) 
    123124        elif self.contInd == 3: 
    124             preprocessor = Preprocessor_removeDiscrete() 
     125            preprocessor = preprocess.RemoveDiscrete() 
    125126        return preprocessor 
    126127     
    127128    def setContinuizer(self, continuizer): 
    128         if isinstance(continuizer, Preprocessor_removeDiscrete): 
     129        if isinstance(continuizer, preprocess.RemoveDiscrete): 
    129130            self.contInd = 3 #Ignore all discrete 
    130         elif isinstance(continuizer,Preprocessor_continuize): 
     131        elif isinstance(continuizer,preprocess.Continuize): 
    131132            self.contInd = self.TREATMENT_TO_IND.get(continuizer.multinomialTreatment, 3) 
    132133     
    133     data = _pyqtProperty(Preprocessor_continuize, 
     134    data = _pyqtProperty(preprocess.Continuize, 
    134135                        fget=getContinuizer, 
    135136                        fset=setContinuizer, 
     
    155156        if self.methodInd in [0, 1, 2]: 
    156157            learner = self.IMPUTERS[self.methodInd][1]() 
    157             imputer = Preprocessor_imputeByLearner(learner=learner) 
     158            imputer = preprocess.ImputeByLearner(learner=learner) 
    158159        elif self.methodInd == 3: 
    159             imputer = orange.Preprocessor_dropMissing() 
     160            imputer = preprocess.DropMissing() 
    160161        return imputer 
    161162             
     
    163164    def setImputer(self, imputer): 
    164165        self.methodInd = 0 
    165         if isinstance(imputer, Preprocessor_imputeByLearner): 
     166        if isinstance(imputer, preprocess.ImputeByLearner): 
    166167            learner = imputer.learner 
    167168            dd = dict([(t, i) for i, (_, t) in enumerate(self.IMPUTERS)]) 
    168169            self.methodInd = dd.get(_gettype(learner), 0) 
    169         elif isinstance(imputer, orange.Preprocessor_dropMissing): 
     170        elif isinstance(imputer, preprocess.DropMissing): 
    170171            self.methodInd = 3 
    171172             
    172     data = _pyqtProperty(Preprocessor_imputeByLearner, 
     173    data = _pyqtProperty(preprocess.ImputeByLearner, 
    173174                        fget=getImputer, 
    174175                        fset=setImputer, 
     
    183184                ("Linear SVM weights", orngSVM.MeasureAttribute_SVMWeights)] 
    184185     
    185     FILTERS = [Preprocessor_featureSelection.bestN, 
    186                Preprocessor_featureSelection.bestP] 
     186    FILTERS = [preprocess.FeatureSelection.bestN, 
     187               preprocess.FeatureSelection.bestP] 
    187188     
    188189    def __init__(self, parent=None): 
     
    235236     
    236237    def getFeatureSelection(self): 
    237         return Preprocessor_featureSelection(measure=self.MEASURES[self.measureInd][1], 
     238        return preprocess.FeatureSelection(measure=self.MEASURES[self.measureInd][1], 
    238239                                             filter=self.FILTERS[self.selectBy], 
    239240                                             limit=self.bestP if self.selectBy  else self.bestN) 
    240241     
    241     data = _pyqtProperty(Preprocessor_featureSelection, 
     242    data = _pyqtProperty(preprocess.FeatureSelection, 
    242243                        fget=getFeatureSelection, 
    243244                        fset=setFeatureSelection, 
     
    245246         
    246247class SampleEditor(BaseEditor): 
    247     FILTERS = [Preprocessor_sample.selectNRandom, 
    248                Preprocessor_sample.selectPRandom] 
     248    FILTERS = [preprocess.Sample.selectNRandom, 
     249               preprocess.Sample.selectPRandom] 
    249250    def __init__(self, parent=None): 
    250251        BaseEditor.__init__(self, parent) 
     
    278279         
    279280    def getSampler(self): 
    280         return Preprocessor_sample(filter=self.FILTERS[self.methodInd], 
     281        return preprocess.Sample(filter=self.FILTERS[self.methodInd], 
    281282                                   limit=self.sampleN if self.methodInd == 0 else self.sampleP) 
    282283     
     
    291292        self.updateSpinStates() 
    292293             
    293     data = _pyqtProperty(Preprocessor_sample, 
     294    data = _pyqtProperty(preprocess.Sample, 
    294295                        fget=getSampler, 
    295296                        fset=setSampler, 
     
    302303         
    303304    #Preprocessor name replacement rules 
    304     REPLACE = {Preprocessor_discretize: "Discretize ({0.method})", 
    305                Preprocessor_discretizeEntropy: "Discretize (entropy)", 
    306                Preprocessor_removeContinuous: "Discretize (remove continuous)", 
    307                Preprocessor_continuize: "Continuize ({0.multinomialTreatment})", 
    308                Preprocessor_removeDiscrete: "Continuize (remove discrete)", 
    309                Preprocessor_impute: "Impute ({0.model})", 
    310                Preprocessor_imputeByLearner: "Impute ({0.learner})", 
    311                Preprocessor_dropMissing: "Remove missing", 
    312                Preprocessor_featureSelection: "Feature selection ({0.measure}, {0.filter}, {0.limit})", 
    313                Preprocessor_sample: "Sample ({0.filter}, {0.limit})", 
     305    REPLACE = {preprocess.Discretize: "Discretize ({0.method})", 
     306               preprocess.DiscretizeEntropy: "Discretize (entropy)", 
     307               preprocess.RemoveContinuous: "Discretize (remove continuous)", 
     308               preprocess.Continuize: "Continuize ({0.multinomialTreatment})", 
     309               preprocess.RemoveDiscrete: "Continuize (remove discrete)", 
     310               preprocess.Impute: "Impute ({0.model})", 
     311               preprocess.ImputeByLearner: "Impute ({0.learner})", 
     312               preprocess.DropMissing: "Remove missing", 
     313               preprocess.FeatureSelection: "Feature selection ({0.measure}, {0.filter}, {0.limit})", 
     314               preprocess.Sample: "Sample ({0.filter}, {0.limit})", 
    314315               orange.EntropyDiscretization: "entropy", 
    315316               orange.EquiNDiscretization: "freq, {0.numberOfIntervals}", 
     
    447448     
    448449    # Default preprocessors 
    449     preprocessors =[("Discretize", Preprocessor_discretizeEntropy, {}), 
    450                     ("Continuize", Preprocessor_continuize, {}), 
    451                     ("Impute", Preprocessor_impute, {}), 
    452                     ("Feature selection", Preprocessor_featureSelection, {}), 
    453                     ("Sample", Preprocessor_sample, {})] 
     450    preprocessors =[("Discretize", preprocess.DiscretizeEntropy, {}), 
     451                    ("Continuize", preprocess.Continuize, {}), 
     452                    ("Impute", preprocess.Impute, {}), 
     453                    ("Feature selection", preprocess.FeatureSelection, {}), 
     454                    ("Sample", preprocess.Sample, {})] 
    454455     
    455456    # Editor widgets for preprocessors 
    456     EDITORS = {Preprocessor_discretize: DiscretizeEditor, 
    457                Preprocessor_discretizeEntropy: DiscretizeEditor, 
    458                Preprocessor_removeContinuous: DiscretizeEditor, 
    459                Preprocessor_continuize: ContinuizeEditor, 
    460                Preprocessor_removeDiscrete: ContinuizeEditor, 
    461                Preprocessor_impute: ImputeEditor, 
    462                Preprocessor_imputeByLearner: ImputeEditor, 
    463                Preprocessor_dropMissing: ImputeEditor, 
    464                Preprocessor_featureSelection: FeatureSelectEditor, 
    465                Preprocessor_sample: SampleEditor, 
     457    EDITORS = {preprocess.Discretize: DiscretizeEditor, 
     458               preprocess.DiscretizeEntropy: DiscretizeEditor, 
     459               preprocess.RemoveContinuous: DiscretizeEditor, 
     460               preprocess.Continuize: ContinuizeEditor, 
     461               preprocess.RemoveDiscrete: ContinuizeEditor, 
     462               preprocess.Impute: ImputeEditor, 
     463               preprocess.ImputeByLearner: ImputeEditor, 
     464               preprocess.DropMissing: ImputeEditor, 
     465               preprocess.FeatureSelection: FeatureSelectEditor, 
     466               preprocess.Sample: SampleEditor, 
    466467               type(None): QWidget} 
    467468     
     
    476477         
    477478#        self.allSchemas = [PreprocessorSchema("Default" , [Preprocessor_discretize(method=orange.EntropyDiscretization()), Preprocessor_dropMissing()])] 
    478         self.allSchemas = [("Default" , [Preprocessor_discretizeEntropy(method=orange.EntropyDiscretization()), Preprocessor_dropMissing()], 0)] 
     479        self.allSchemas = [("Default" , [preprocess.DiscretizeEntropy(method=orange.EntropyDiscretization()), 
     480                                         preprocess.DropMissing()], 0)] 
    479481         
    480482        self.lastSelectedSchemaIndex = 0 
  • Orange/OrangeWidgets/Visualize Qt/OWLinProj3DPlot.py

    r9671 r10542  
    55from plot import OWPoint 
    66 
    7 from Orange.preprocess.scaling import ScaleLinProjData3D, get_variable_values_sorted 
     7from Orange.data.preprocess.scaling import ScaleLinProjData3D, get_variable_values_sorted 
    88import orange 
    99Discrete = orange.VarTypes.Discrete 
  • Orange/OrangeWidgets/Visualize Qt/OWScatterPlot3D.py

    r9671 r10542  
    1616Continuous = orange.VarTypes.Continuous 
    1717 
    18 from Orange.preprocess.scaling import get_variable_values_sorted 
     18from Orange.data.preprocess.scaling import get_variable_values_sorted 
    1919 
    2020import OWGUI 
  • Orange/OrangeWidgets/plot/owtools.py

    r9671 r10542  
    4141from owpalette import OWPalette 
    4242 
    43 from Orange.preprocess.scaling import get_variable_values_sorted 
     43from Orange.data.preprocess.scaling import get_variable_values_sorted 
    4444import orangeom 
    4545import ColorPalette 
  • Orange/classification/logreg.py

    r10387 r10542  
    11import Orange 
    22from Orange.misc import deprecated_keywords, deprecated_members 
     3from Orange.data import preprocess 
    34import math 
     5 
     6 
    47from numpy import dot, array, identity, reshape, diagonal, \ 
    58    transpose, concatenate, sqrt, sign 
     
    746749        examples = self.imputer(examples)(examples) 
    747750    if getattr(self, "removeMissing", 0): 
    748         examples = Orange.core.Preprocessor_dropMissing(examples) 
    749     continuizer = Orange.preprocess.DomainContinuizer(zeroBased=1, 
    750         continuousTreatment=Orange.preprocess.DomainContinuizer.Leave, 
    751                                            multinomialTreatment = Orange.preprocess.DomainContinuizer.FrequentIsBase, 
    752                                            classTreatment = Orange.preprocess.DomainContinuizer.Ignore) 
     751        examples = preprocess.DropMissing(examples) 
     752    continuizer = preprocess.DomainContinuizer(zeroBased=1, 
     753        continuousTreatment=preprocess.DomainContinuizer.Leave, 
     754                                           multinomialTreatment = preprocess.DomainContinuizer.FrequentIsBase, 
     755                                           classTreatment = preprocess.DomainContinuizer.Ignore) 
    753756    attr = [] 
    754757    remain_attr = examples.domain.features[:] 
  • Orange/classification/svm/__init__.py

    r10369 r10542  
    1818                        SVMClassifierSparse 
    1919 
    20 from Orange.preprocess import Preprocessor_impute, \ 
    21                               Preprocessor_continuize, \ 
    22                               Preprocessor_preprocessorList, \ 
    23                               DomainContinuizer 
     20from Orange.data import preprocess 
    2421 
    2522from Orange import feature as variable 
     
    243240 
    244241    def _normalize(self, data): 
    245         dc = Orange.core.DomainContinuizer() 
    246         dc.class_treatment = Orange.core.DomainContinuizer.Ignore 
    247         dc.continuous_treatment = Orange.core.DomainContinuizer.NormalizeBySpan 
    248         dc.multinomial_treatment = Orange.core.DomainContinuizer.NValues 
     242        dc = preprocess.DomainContinuizer() 
     243        dc.class_treatment = preprocess.DomainContinuizer.Ignore 
     244        dc.continuous_treatment = preprocess.DomainContinuizer.NormalizeBySpan 
     245        dc.multinomial_treatment = preprocess.DomainContinuizer.NValues 
    249246        newdomain = dc(data) 
    250247        return data.translate(newdomain) 
     
    308305    def _normalize(self, data): 
    309306        if self.use_non_meta: 
    310             dc = Orange.core.DomainContinuizer() 
    311             dc.class_treatment = Orange.core.DomainContinuizer.Ignore 
    312             dc.continuous_treatment = Orange.core.DomainContinuizer.NormalizeBySpan 
    313             dc.multinomial_treatment = Orange.core.DomainContinuizer.NValues 
     307            dc = preprocess.DomainContinuizer() 
     308            dc.class_treatment = preprocess.DomainContinuizer.Ignore 
     309            dc.continuous_treatment = preprocess.DomainContinuizer.NormalizeBySpan 
     310            dc.multinomial_treatment = preprocess.DomainContinuizer.NValues 
    314311            newdomain = dc(data) 
    315312            data = data.translate(newdomain) 
     
    332329 
    333330    def learn_classifier(self, data): 
    334         transformer = Orange.core.DomainContinuizer() 
    335         transformer.multinomialTreatment = Orange.core.DomainContinuizer.NValues 
     331        transformer = preprocess.DomainContinuizer() 
     332        transformer.multinomialTreatment = preprocess.DomainContinuizer.NValues 
    336333        transformer.continuousTreatment = \ 
    337             Orange.core.DomainContinuizer.NormalizeBySpan 
    338         transformer.classTreatment = Orange.core.DomainContinuizer.Ignore 
     334            preprocess.DomainContinuizer.NormalizeBySpan 
     335        transformer.classTreatment = preprocess.DomainContinuizer.Ignore 
    339336        newdomain = transformer(data) 
    340337        newexamples = data.translate(newdomain) 
     
    371368    # Construct and return a default preprocessor for use by 
    372369    # Orange.core.LinearLearner learner. 
    373     impute = Preprocessor_impute() 
    374     cont = Preprocessor_continuize(multinomialTreatment= 
    375                                    DomainContinuizer.AsOrdinal) 
    376     preproc = Preprocessor_preprocessorList(preprocessors= 
     370    impute = preprocess.Impute() 
     371    cont = preprocess.Continuize(multinomialTreatment= 
     372                                   preprocess.DomainContinuizer.AsOrdinal) 
     373    preproc = preprocess.PreprocessorList(preprocessors= 
    377374                                            [impute, cont]) 
    378375    return preproc 
  • Orange/clustering/mixture.py

    r9976 r10542  
    290290         
    291291    def __call__(self, data, weight_id=None): 
    292         from Orange.preprocess import Preprocessor_impute, DomainContinuizer 
     292        from Orange.data import preprocess 
     293        #import Preprocessor_impute, DomainContinuizer 
    293294#        data = Preprocessor_impute(data) 
    294         dc = DomainContinuizer() 
    295         dc.multinomial_treatment = DomainContinuizer.AsOrdinal 
    296         dc.continuous_treatment = DomainContinuizer.NormalizeByVariance 
    297         dc.class_treatment = DomainContinuizer.Ignore 
     295        dc = preprocess.DomainContinuizer() 
     296        dc.multinomial_treatment = preprocess.DomainContinuizer.AsOrdinal 
     297        dc.continuous_treatment = preprocess.DomainContinuizer.NormalizeByVariance 
     298        dc.class_treatment = preprocess.DomainContinuizer.Ignore 
    298299        domain = dc(data) 
    299300        data = data.translate(domain) 
     
    308309#        array /= std.reshape((1, -1)) 
    309310#        means /= std.reshape((1, -1)) 
    310         solver = EMSolver(array, numpy.ones((self.n)) / self.n, 
     311        solver = EMSolver(array, numpy.ones(self.n) / self.n, 
    311312                          means, correlations) 
    312313        solver.run() 
  • Orange/data/preprocess/__init__.py

    r10393 r10542  
    1 """ 
    2 .. autoclass:: Preprocessor_discretizeEntropy(method=Orange.feature.discretization.Entropy()) 
    3  
    4 .. autoclass:: Preprocessor_removeContinuous 
    5  
    6 .. autoclass:: Preprocessor_continuize 
    7  
    8 .. autoclass:: Preprocessor_removeDiscrete 
    9  
    10 .. autoclass:: Preprocessor_impute 
    11  
    12 .. autoclass:: Preprocessor_featureSelection(measure=Orange.feature.scoring.Relief(), filter=None, limit=10) 
    13  
    14 .. autofunction:: bestP 
    15  
    16 .. autofunction:: bestN 
    17  
    18 .. autofunction:: selectNRandom 
    19  
    20 .. autofunction:: selectPRandom 
    21  
    22 .. autoclass:: Preprocessor_RFE 
    23  
    24 .. autoclass:: Preprocessor_sample 
    25  
    26 .. autoclass:: Preprocessor_preprocessorList 
    27  
    28 .. class:: RemoveUnusedValues(variable, data, remove_one_valued=False) 
    29  
    30     Removes unused values and reduces the variable, if a variable 
    31     declares values that do not appear in the data. 
    32  
    33     :param variable: :class:`Orange.feature.Descriptor` 
    34     :param data: :class:`Orange.data.Table` 
    35     :param remove_one_valued: Decides whether to remove or to retain 
    36         the attributes with only one value defined (default: False). 
    37      
    38     Example: 
    39      
    40     .. literalinclude:: code/unusedValues.py     
    41  
    42     There are four possible outcomes: 
    43      
    44     1. The variable does not have any used values in the data - value 
    45     of this variable is undefined for all examples. The variable is 
    46     thus useless and the class returns None. 
    47  
    48     2. The variable has only one used value (or, possibly, only one 
    49     value at all). Such a variable is in fact useless, and can 
    50     probably be removed without harm. Nevertheless, its fate is 
    51     decided by the flag remove_one_valued which is False by default, 
    52     so such variables are retained unless explicitly specified 
    53     otherwise. 
    54  
    55     3. All variable's values occur in the data (and the variable has more 
    56     than one value; otherwise the above case applies). The original variable 
    57     is returned. 
    58  
    59     4. There are some unused values. A new variable is constructed and the 
    60     unused values are omitted. The value of the new variable is computed 
    61     automatically from the value of the original variable  
    62     :class:`Orange.classification.lookup.ClassifierByLookupTable` is used 
    63     for mapping. 
    64      
    65     Results of example: 
    66      
    67     .. literalinclude:: code/unusedValues.res 
    68      
    69     Variables a and y are OK and are left alone. In b, value 1 is not used 
    70     and is removed (not in the original variable, of course; a new variable 
    71     is created). c is useless and is removed altogether. d is retained since 
    72     remove_one_valued was left at False; if we set it to True, this variable 
    73     would be removed as well. 
    74  
    75 """ 
    76  
    77 from orange import \ 
    78      DomainContinuizer, \ 
    79     VariableFilterMap, \ 
    80     ValueFilter, \ 
    81          ValueFilter_continuous, \ 
    82          ValueFilter_discrete, \ 
    83          ValueFilter_string, \ 
    84          ValueFilter_stringList, \ 
    85     ValueFilterList, \ 
    86     TransformValue, \ 
    87          Discrete2Continuous, \ 
    88          Discretizer, \ 
    89               BiModalDiscretizer, \ 
    90               EquiDistDiscretizer, \ 
    91               IntervalDiscretizer, \ 
    92               ThresholdDiscretizer, \ 
    93          MapIntValue, \ 
    94          NormalizeContinuous, \ 
    95          Ordinal2Continuous, \ 
    96          TransformValue_IsDefined, \ 
    97     TableAverager, \ 
    98     Preprocessor, \ 
    99          Preprocessor_addCensorWeight, \ 
    100          Preprocessor_addClassNoise, \ 
    101          Preprocessor_addClassWeight, \ 
    102          Preprocessor_addGaussianClassNoise, \ 
    103          Preprocessor_addGaussianNoise, \ 
    104          Preprocessor_addMissing, \ 
    105          Preprocessor_addMissingClasses, \ 
    106          Preprocessor_addNoise, \ 
    107          Preprocessor_discretize, \ 
    108          Preprocessor_drop, \ 
    109          Preprocessor_dropMissing, \ 
    110          Preprocessor_dropMissingClasses, \ 
    111          Preprocessor_filter, \ 
    112          Preprocessor_ignore, \ 
    113          Preprocessor_imputeByLearner, \ 
    114          Preprocessor_removeDuplicates, \ 
    115          Preprocessor_select, \ 
    116          Preprocessor_shuffle, \ 
    117          Preprocessor_take, \ 
    118          Preprocessor_takeMissing, \ 
    119          Preprocessor_takeMissingClasses, \ 
    120     Imputer, \ 
    121          Imputer_asValue, \ 
    122          Imputer_defaults, \ 
    123          Imputer_model, \ 
    124          Imputer_random, \ 
    125     ImputerConstructor, \ 
    126          ImputerConstructor_asValue, \ 
    127          ImputerConstructor_average, \ 
    128          ImputerConstructor_maximal, \ 
    129          ImputerConstructor_minimal, \ 
    130          ImputerConstructor_model, \ 
    131          ImputerConstructor_random, \ 
    132     FilterList, \ 
    133     Filter, \ 
    134          Filter_conjunction, \ 
    135          Filter_disjunction, \ 
    136          Filter_hasClassValue, \ 
    137          Filter_hasMeta, \ 
    138          Filter_hasSpecial, \ 
    139          Filter_isDefined, \ 
    140          Filter_random, \ 
    141          Filter_sameValue, \ 
    142          Filter_values, \ 
    143     Discretization, \ 
    144          BiModalDiscretization, \ 
    145          EntropyDiscretization, \ 
    146          EquiDistDiscretization, \ 
    147          EquiNDiscretization, \ 
    148     DomainTransformerConstructor, \ 
    149     RemoveRedundant, \ 
    150          RemoveRedundantByInduction, \ 
    151          RemoveRedundantByQuality, \ 
    152          RemoveRedundantOneValue, \ 
    153     RemoveUnusedValues 
     1from Orange import core 
     2 
     3DomainContinuizer = core.DomainContinuizer 
     4VariableFilterMap = core.VariableFilterMap 
     5 
     6ValueFilter = core.ValueFilter 
     7ValueFilter_continuous = core.ValueFilter_continuous 
     8ValueFilter_discrete = core.ValueFilter_discrete 
     9ValueFilter_string = core.ValueFilter_string 
     10ValueFilter_stringList = core.ValueFilter_stringList 
     11ValueFilterList = core.ValueFilterList 
     12 
     13TransformValue = core.TransformValue 
     14Discrete2Continuous = core.Discrete2Continuous 
     15Discretizer = core.Discretizer 
     16BiModalDiscretizer = core.BiModalDiscretizer 
     17EquiDistDiscretizer = core.EquiDistDiscretizer 
     18IntervalDiscretizer = core.IntervalDiscretizer 
     19ThresholdDiscretizer = core.ThresholdDiscretizer 
     20MapIntValue = core.MapIntValue 
     21NormalizeContinuous = core.NormalizeContinuous 
     22Ordinal2Continuous = core.Ordinal2Continuous 
     23TransformValue_IsDefined = core.TransformValue_IsDefined 
     24 
     25TableAverager = core.TableAverager 
     26 
     27Preprocessor = core.Preprocessor 
     28AddCensorWeight = core.Preprocessor_addCensorWeight 
     29AddClassNoise = core.Preprocessor_addClassNoise 
     30AddClassWeight = core.Preprocessor_addClassWeight 
     31AddGaussianClassNoise = core.Preprocessor_addGaussianClassNoise 
     32AddGaussianNoise = core.Preprocessor_addGaussianNoise 
     33AddMissing = core.Preprocessor_addMissing 
     34AddMissingClasses = core.Preprocessor_addMissingClasses 
     35AddNoise = core.Preprocessor_addNoise 
     36 
     37Discretize = core.Preprocessor_discretize 
     38Drop = core.Preprocessor_drop 
     39DropMissing = core.Preprocessor_dropMissing 
     40DropMissingClasses = core.Preprocessor_dropMissingClasses 
     41Filter = core.Preprocessor_filter 
     42Ignore = core.Preprocessor_ignore 
     43ImputeByLearner = core.Preprocessor_imputeByLearner 
     44RemoveDuplicates = core.Preprocessor_removeDuplicates 
     45Select = core.Preprocessor_select 
     46Shuffle = core.Preprocessor_shuffle 
     47Take = core.Preprocessor_take 
     48TakeMissing = core.Preprocessor_takeMissing 
     49TakeMissingClasses = core.Preprocessor_takeMissingClasses 
     50 
     51Imputer = core.Imputer 
     52Imputer_asValue = core.Imputer_asValue 
     53Imputer_defaults = core.Imputer_defaults 
     54Imputer_model = core.Imputer_model 
     55Imputer_random = core.Imputer_random 
     56 
     57ImputerConstructor = core.ImputerConstructor 
     58ImputerConstructor_asValue = core.ImputerConstructor_asValue 
     59ImputerConstructor_average = core.ImputerConstructor_average 
     60ImputerConstructor_maximal = core.ImputerConstructor_maximal 
     61ImputerConstructor_minimal = core.ImputerConstructor_minimal 
     62ImputerConstructor_model = core.ImputerConstructor_model 
     63ImputerConstructor_random = core.ImputerConstructor_random 
     64 
     65FilterList = core.FilterList 
     66Filter = core.Filter 
     67Filter_conjunction = core.Filter_conjunction 
     68Filter_disjunction = core.Filter_disjunction 
     69Filter_hasClassValue = core.Filter_hasClassValue 
     70Filter_hasMeta = core.Filter_hasMeta 
     71Filter_hasSpecial = core.Filter_hasSpecial 
     72Filter_isDefined = core.Filter_isDefined 
     73Filter_random = core.Filter_random 
     74Filter_sameValue = core.Filter_sameValue 
     75Filter_values = core.Filter_values 
     76 
     77Discretization = core.Discretization 
     78BiModalDiscretization = core.BiModalDiscretization 
     79EntropyDiscretization = core.EntropyDiscretization 
     80EquiDistDiscretization = core.EquiDistDiscretization 
     81EquiNDiscretization = core.EquiNDiscretization 
     82 
     83DomainTransformerConstructor = core.DomainTransformerConstructor 
     84 
     85RemoveRedundant = core.RemoveRedundant 
     86RemoveRedundantByInduction = core.RemoveRedundantByInduction 
     87RemoveRedundantByQuality = core.RemoveRedundantByQuality 
     88RemoveRedundantOneValue = core.RemoveRedundantOneValue 
     89RemoveUnusedValues = core.RemoveUnusedValues 
    15490 
    15591import math 
    15692 
    157 import orange 
    15893import Orange 
     94import Orange.classification.majority 
     95import Orange.data 
     96import Orange.feature 
     97import Orange.feature.discretization 
     98import Orange.feature.scoring 
    15999from Orange.misc import _orange__new__, _orange__reduce__ 
    160100 
    161 class Preprocessor_discretizeEntropy(Preprocessor_discretize): 
     101class DiscretizeEntropy(Discretize): 
    162102    """ An discretizer that uses orange.EntropyDiscretization method but, 
    163103    unlike Preprocessor_discretize class, also removes unused attributes 
    164104    from the domain. 
    165      
    166     """ 
    167      
    168     __new__ = _orange__new__(Preprocessor_discretize) 
     105    """ 
     106     
     107    __new__ = _orange__new__(Discretize) 
    169108    __reduce__ = _orange__reduce__ 
    170109     
     
    173112        assert(isinstance(method, Orange.feature.discretization.Entropy)) 
    174113         
    175     def __call__(self, data, wightId=0): 
     114    def __call__(self, data, weightId=0): 
    176115        newattr_list = [] 
    177116        for attr in data.domain.attributes: 
    178             if attr.varType == orange.VarTypes.Continuous: 
     117            if attr.varType == Orange.feature.Type.Continuous: 
    179118                newattr = self.method(attr, data) 
    180119                if newattr.getValueFrom.transformer.points: 
     
    182121            else: 
    183122                newattr_list.append(attr) 
    184         newdomain = orange.Domain(newattr_list, data.domain.classVar) 
     123        newdomain = Orange.data.Domain(newattr_list, data.domain.classVar) 
    185124        newdomain.addmetas(data.domain.getmetas()) 
    186         return orange.ExampleTable(newdomain, data) 
    187      
    188 class Preprocessor_removeContinuous(Preprocessor_discretize): 
     125        return Orange.data.Table(newdomain, data) 
     126     
     127class RemoveContinuous(Discretize): 
    189128    """ A preprocessor that removes all continuous features. 
    190129    """ 
    191     __new__ = _orange__new__(Preprocessor_discretize) 
    192     __reduce__ = _orange__reduce__ 
    193      
    194     def __call__(self, data, weightId=None): 
    195         attrs = [attr for attr in data.domain.attributes if attr.varType == orange.VarTypes.Discrete] 
    196         domain = orange.Domain(attrs, data.domain.classVar) 
     130    __new__ = _orange__new__(Discretize) 
     131    __reduce__ = _orange__reduce__ 
     132     
     133    def __call__(self, data, weightId=None): 
     134        attrs = [attr for attr in data.domain.attributes if attr.varType == Orange.feature.Type.Discrete] 
     135        domain = Orange.data.Domain(attrs, data.domain.classVar) 
    197136        domain.addmetas(data.domain.getmetas()) 
    198         return orange.ExampleTable(domain, data) 
     137        return Orange.data.Table(domain, data) 
    199138                 
    200 class Preprocessor_continuize(orange.Preprocessor): 
     139class Continuize(Preprocessor): 
    201140    """ A preprocessor that continuizes a discrete domain (and optionally normalizes it). 
    202141    See :obj:`Orange.data.continuization.DomainContinuizer` for list of 
     
    204143     
    205144    """ 
    206     __new__ = _orange__new__(orange.Preprocessor) 
    207     __reduce__ = _orange__reduce__ 
    208      
    209     def __init__(self, zeroBased=True, multinomialTreatment=orange.DomainContinuizer.NValues, 
    210                  continuousTreatment=orange.DomainContinuizer.Leave, 
    211                  classTreatment=orange.DomainContinuizer.Ignore, 
     145    __new__ = _orange__new__(Preprocessor) 
     146    __reduce__ = _orange__reduce__ 
     147     
     148    def __init__(self, zeroBased=True, multinomialTreatment=DomainContinuizer.NValues, 
     149                 continuousTreatment=DomainContinuizer.Leave, 
     150                 classTreatment=DomainContinuizer.Ignore, 
    212151                 **kwargs): 
    213152        self.zeroBased = zeroBased 
     
    217156             
    218157    def __call__(self, data, weightId=0): 
    219         continuizer = orange.DomainContinuizer(zeroBased=self.zeroBased, 
    220                                                multinomialTreatment=self.multinomialTreatment, 
    221                                                continuousTreatment=self.continuousTreatment, 
    222                                                classTreatment=self.classTreatment) 
     158        continuizer = DomainContinuizer(zeroBased=self.zeroBased, 
     159                                        multinomialTreatment=self.multinomialTreatment, 
     160                                        continuousTreatment=self.continuousTreatment, 
     161                                        classTreatment=self.classTreatment) 
    223162        c_domain = continuizer(data, weightId) 
    224163        return data.translate(c_domain) 
    225164     
    226 class Preprocessor_removeDiscrete(Preprocessor_continuize): 
     165class RemoveDiscrete(Continuize): 
    227166    """ A Preprocessor that removes all discrete attributes from the domain. 
    228167    """ 
    229     __new__ = _orange__new__(Preprocessor_continuize) 
    230      
    231     def __call__(self, data, weightId=None): 
    232         attrs = [attr for attr in data.domain.attributes if attr.varType == orange.VarTypes.Continuous] 
    233         domain = orange.Domain(attrs, data.domain.classVar) 
     168    __new__ = _orange__new__(Continuize) 
     169     
     170    def __call__(self, data, weightId=None): 
     171        attrs = [attr for attr in data.domain.attributes if attr.varType == Orange.feature.Type.Continuous] 
     172        domain = Orange.data.Domain(attrs, data.domain.classVar) 
    234173        domain.addmetas(data.domain.getmetas()) 
    235         return orange.ExampleTable(domain, data) 
     174        return Orange.data.Table(domain, data) 
    236175          
    237 class Preprocessor_impute(orange.Preprocessor): 
     176class Impute(Preprocessor): 
    238177    """ A preprocessor that imputes unknown values using a learner. 
    239178     
     
    241180     
    242181    """ 
    243     __new__ = _orange__new__(orange.Preprocessor) 
     182    __new__ = _orange__new__(Preprocessor) 
    244183    __reduce__ = _orange__reduce__ 
    245184     
    246185    def __init__(self, model=None, **kwargs): 
    247         self.model = orange.MajorityLearner() if model is None else model 
     186        self.model = Orange.classification.majority.MajorityLearner() if model is None else model 
    248187         
    249188    def __call__(self, data, weightId=0): 
    250         return orange.Preprocessor_imputeByLearner(data, learner=self.model) 
     189        return ImputeByLearner(data, learner=self.model) 
    251190 
    252191def bestN(attrMeasures, N=10): 
     
    254193    """ 
    255194    return attrMeasures[-N:] 
     195_bestN = bestN 
    256196 
    257197def bestP(attrMeasures, P=10): 
     
    260200    count = len(attrMeasures) 
    261201    return  attrMeasures[-max(int(math.ceil(count * P / 100.0)), 1):] 
    262  
    263 class Preprocessor_featureSelection(orange.Preprocessor): 
     202_bestP = bestP 
     203 
     204class FeatureSelection(Preprocessor): 
    264205    """ A preprocessor that runs feature selection using an feature scoring function. 
    265206     
     
    269210         
    270211    """ 
    271     __new__ = _orange__new__(orange.Preprocessor) 
    272     __reduce__ = _orange__reduce__ 
    273      
    274     bestN = staticmethod(bestN) 
    275     bestP = staticmethod(bestP) 
     212    __new__ = _orange__new__(Preprocessor) 
     213    __reduce__ = _orange__reduce__ 
     214     
     215    bestN = staticmethod(_bestN) 
     216    bestP = staticmethod(_bestP) 
    276217     
    277218    def __init__(self, measure=Orange.feature.scoring.Relief(), filter=None, limit=10): 
     
    289230        measures = self.attrScores(data) 
    290231        attrs = [attr for _, attr in self.filter(measures, self.limit)] 
    291         domain = orange.Domain(attrs, data.domain.classVar) 
     232        domain = Orange.data.Domain(attrs, data.domain.classVar) 
    292233        domain.addmetas(data.domain.getmetas()) 
    293         return orange.ExampleTable(domain, data) 
    294      
    295 class Preprocessor_RFE(Preprocessor_featureSelection): 
     234        return Orange.data.Table(domain, data) 
     235     
     236class RFE(FeatureSelection): 
    296237    """ A preprocessor that runs RFE(Recursive Feature Elimination) using 
    297238    linear SVM derived attribute weights. 
     
    302243         
    303244    """ 
    304     __new__ = _orange__new__(Preprocessor_featureSelection) 
    305     __reduce__ = _orange__reduce__ 
     245    __new__ = _orange__new__(FeatureSelection) 
     246    __reduce__ = _orange__reduce__ 
     247 
    306248    def __init__(self, filter=None, limit=10): 
    307         self.limit = limit 
    308         self.filter = filter if filter is not None else self.bestN 
     249        super(RFE, self).__init__(filter=filter, limit=limit) 
    309250         
    310251    def __call__(self, data, weightId=None): 
     
    319260    import random 
    320261    return random.sample(examples, N) 
     262_selectNRandom = selectNRandom 
    321263 
    322264def selectPRandom(examples, P=10): 
     
    326268    count = len(examples) 
    327269    return random.sample(examples, max(int(math.ceil(count * P / 100.0)), 1)) 
    328  
    329 class Preprocessor_sample(orange.Preprocessor): 
     270_selectPRandom = selectPRandom 
     271 
     272class Sample(Preprocessor): 
    330273    """ A preprocessor that samples a subset of the data. 
    331274     
     
    335278     
    336279    """ 
    337     __new__ = _orange__new__(orange.Preprocessor) 
    338     __reduce__ = _orange__reduce__ 
    339  
    340     selectNRandom = staticmethod(selectNRandom) 
    341     selectPRandom = staticmethod(selectPRandom) 
     280    __new__ = _orange__new__(Preprocessor) 
     281    __reduce__ = _orange__reduce__ 
     282 
     283    selectNRandom = staticmethod(_selectNRandom) 
     284    selectPRandom = staticmethod(_selectPRandom) 
    342285     
    343286    def __init__(self, filter=None, limit=10): 
     
    346289         
    347290    def __call__(self, data, weightId=None): 
    348         return orange.ExampleTable(data.domain, self.filter(data, self.limit)) 
    349      
    350  
    351 class Preprocessor_preprocessorList(orange.Preprocessor): 
     291        return Orange.data.Table(data.domain, self.filter(data, self.limit)) 
     292     
     293 
     294class PreprocessorList(Preprocessor): 
    352295    """ A preprocessor wrapping a sequence of other preprocessors. 
    353296     
     
    356299    """ 
    357300     
    358     __new__ = _orange__new__(orange.Preprocessor) 
    359     __reduce__ = _orange__reduce__ 
    360      
    361     def __init__(self, preprocessors=[]): 
     301    __new__ = _orange__new__(Preprocessor) 
     302    __reduce__ = _orange__reduce__ 
     303     
     304    def __init__(self, preprocessors=()): 
    362305        self.preprocessors = preprocessors 
    363306         
    364307    def __call__(self, data, weightId=None): 
    365         import orange 
    366308        hadWeight = hasWeight = weightId is not None 
    367309        for preprocessor in self.preprocessors: 
  • Orange/data/preprocess/scaling.py

    r10475 r10542  
    1313documentation is poor and has to be improved in the future. 
    1414 
    15 .. autoclass:: Orange.preprocess.scaling.ScaleData 
     15.. autoclass:: Orange.data.preprocess.scaling.ScaleData 
    1616   :members: 
    1717   :show-inheritance: 
    1818 
    19 .. autoclass:: Orange.preprocess.scaling.ScaleLinProjData 
     19.. autoclass:: Orange.data.preprocess.scaling.ScaleLinProjData 
    2020   :members: 
    2121   :show-inheritance: 
    2222 
    23 .. autoclass:: Orange.preprocess.scaling.ScaleLinProjData3D 
     23.. autoclass:: Orange.data.preprocess.scaling.ScaleLinProjData3D 
    2424   :members: 
    2525   :show-inheritance: 
    2626 
    27 .. autoclass:: Orange.preprocess.scaling.ScalePolyvizData 
     27.. autoclass:: Orange.data.preprocess.scaling.ScalePolyvizData 
    2828   :members: 
    2929   :show-inheritance: 
    3030 
    31 .. autoclass:: Orange.preprocess.scaling.ScaleScatterPlotData 
     31.. autoclass:: Orange.data.preprocess.scaling.ScaleScatterPlotData 
    3232   :members: 
    3333   :show-inheritance: 
     
    5656import Orange 
    5757import Orange.core 
    58 import Orange.preprocess 
    5958import Orange.data 
     59from Orange.data import preprocess 
     60 
    6061from Orange.misc import caching 
    6162 
     
    7475    """ 
    7576    if variable.var_type == Orange.core.VarTypes.Continuous: 
    76         print "get_variable_values_sorted - attribute %s is a continuous variable" % (variable) 
     77        print "get_variable_values_sorted - attribute %s is a continuous variable" % variable 
    7778        return [] 
    7879 
     
    8384    try: 
    8485        int_values = [(int(val), val) for val in values] 
    85     except: 
     86    except ValueError: 
    8687        return values 
    8788 
     
    9293@deprecated_keywords({"sortValuesForDiscreteAttrs": 
    9394                      "sort_values_for_discrete_attrs"}) 
    94 def get_variable_value_indices(variable, sort_values_for_discrete_attrs = 1): 
     95def get_variable_value_indices(variable, sort_values_for_discrete_attrs=1): 
    9596    """ 
    9697    Create a dictionary with given variable. Keys are variable values, values 
     
    120121    equiN if we don't have a class or class is continuous). 
    121122    """ 
    122     entro_disc = Orange.preprocess.EntropyDiscretization() 
    123     equi_disc  = Orange.preprocess.EquiNDiscretization(number_of_intervals = 
    124                                                        number_of_intervals) 
     123    entro_disc = preprocess.EntropyDiscretization() 
     124    equi_disc  = preprocess.EquiNDiscretization(number_of_intervals=number_of_intervals) 
    125125    disc_attrs = [] 
    126126 
     
    159159                new_attr = attr 
    160160            if remove_unused_values: 
    161                 new_attr = Orange.preprocess.RemoveUnusedValues(new_attr, data) 
     161                new_attr = preprocess.RemoveUnusedValues(new_attr, data) 
    162162                if new_attr is None: 
    163163                    raise Orange.core.KernelException, "No values" 
  • Orange/doc/extend-widgets/owplot_example.py

    r9671 r10542  
    55import random 
    66import orange 
    7 from Orange.preprocess.scaling import get_variable_values_sorted 
     7from Orange.data.preprocess.scaling import get_variable_values_sorted 
    88 
    99class BasicPlot(OWPlot): 
  • Orange/feature/discretization.py

    r9944 r10542  
    3131    """ 
    3232    orange.setrandseed(0) 
    33     data_new = orange.Preprocessor_discretize(data, method=Entropy()) 
     33    data_new = Orange.data.preprocessing.Discretize(data, method=Entropy()) 
    3434     
    3535    attrlist = [] 
     
    109109    def __call__(self, data, weight=None): 
    110110        # filter the data and then learn 
    111         from Orange.preprocess import Preprocessor_discretize 
    112         ddata = Preprocessor_discretize(data, method=self.discretizer) 
     111        from Orange.data.preprocess import Discretize 
     112        ddata = Discretize(data, method=self.discretizer) 
    113113        if weight<>None: 
    114114            model = self.baseLearner(ddata, weight) 
  • Orange/fixes/fix_changed_names.py

    r10378 r10542  
    472472           "orngLR.zprob":"Orange.classification.logreg.zprob", 
    473473 
    474            "orange.Preprocessor": "Orange.preprocess.Preprocessor", 
    475            "orange.Preprocessor_addCensorWeight": "Orange.preprocess.Preprocessor_addCensorWeight", 
    476            "orange.Preprocessor_addClassNoise": "Orange.preprocess.Preprocessor_addClassNoise", 
    477            "orange.Preprocessor_addClassWeight": "Orange.preprocess.Preprocessor_addClassWeight", 
    478            "orange.Preprocessor_addGaussianClassNoise": "Orange.preprocess.Preprocessor_addGaussianClassNoise", 
    479            "orange.Preprocessor_addGaussianNoise": "Orange.preprocess.Preprocessor_addGaussianNoise", 
    480            "orange.Preprocessor_addMissing": "Orange.preprocess.Preprocessor_addMissing", 
    481            "orange.Preprocessor_addMissingClasses": "Orange.preprocess.Preprocessor_addMissingClasses", 
    482            "orange.Preprocessor_addNoise": "Orange.preprocess.Preprocessor_addNoise", 
    483            "orange.Preprocessor_discretize": "Orange.preprocess.Preprocessor_discretize", 
    484            "orange.Preprocessor_drop": "Orange.preprocess.Preprocessor_drop", 
    485            "orange.Preprocessor_dropMissing": "Orange.preprocess.Preprocessor_dropMissing", 
    486            "orange.Preprocessor_dropMissingClasses": "Orange.preprocess.Preprocessor_dropMissingClasses", 
    487            "orange.Preprocessor_filter": "Orange.preprocess.Preprocessor_filter", 
    488            "orange.Preprocessor_ignore": "Orange.preprocess.Preprocessor_ignore", 
    489            "orange.Preprocessor_imputeByLearner": "Orange.preprocess.Preprocessor_imputeByLearner", 
    490            "orange.Preprocessor_removeDuplicates": "Orange.preprocess.Preprocessor_removeDuplicates", 
    491            "orange.Preprocessor_select": "Orange.preprocess.Preprocessor_select", 
    492            "orange.Preprocessor_shuffle": "Orange.preprocess.Preprocessor_shuffle", 
    493            "orange.Preprocessor_take": "Orange.preprocess.Preprocessor_take", 
    494            "orange.Preprocessor_takeMissing": "Orange.preprocess.Preprocessor_takeMissing", 
    495            "orange.Preprocessor_takeMissingClasses": "Orange.preprocess.Preprocessor_takeMissingClasses", 
     474           "orange.Preprocessor": "Orange.data.preprocess.Preprocessor", 
     475           "orange.Preprocessor_addCensorWeight": "Orange.data.preprocess.AddCensorWeight", 
     476           "orange.Preprocessor_addClassNoise": "Orange.data.preprocess.AddClassNoise", 
     477           "orange.Preprocessor_addClassWeight": "Orange.data.preprocess.AddClassWeight", 
     478           "orange.Preprocessor_addGaussianClassNoise": "Orange.data.preprocess.AddGaussianClassNoise", 
     479           "orange.Preprocessor_addGaussianNoise": "Orange.data.preprocess.AddGaussianNoise", 
     480           "orange.Preprocessor_addMissing": "Orange.data.preprocess.AddMissing", 
     481           "orange.Preprocessor_addMissingClasses": "Orange.data.preprocess.AddMissingClasses", 
     482           "orange.Preprocessor_addNoise": "Orange.data.preprocess.AddNoise", 
     483           "orange.Preprocessor_discretize": "Orange.data.preprocess.Discretize", 
     484           "orange.Preprocessor_drop": "Orange.data.preprocess.Drop", 
     485           "orange.Preprocessor_dropMissing": "Orange.data.preprocess.DropMissing", 
     486           "orange.Preprocessor_dropMissingClasses": "Orange.data.preprocess.DropMissingClasses", 
     487           "orange.Preprocessor_filter": "Orange.data.preprocess.Filter", 
     488           "orange.Preprocessor_ignore": "Orange.data.preprocess.Ignore", 
     489           "orange.Preprocessor_imputeByLearner": "Orange.data.preprocess.ImputeByLearner", 
     490           "orange.Preprocessor_removeDuplicates": "Orange.data.preprocess.RemoveDuplicates", 
     491           "orange.Preprocessor_select": "Orange.data.preprocess.Select", 
     492           "orange.Preprocessor_shuffle": "Orange.data.preprocess.Shuffle", 
     493           "orange.Preprocessor_take": "Orange.data.preprocess.Take", 
     494           "orange.Preprocessor_takeMissing": "Orange.data.preprocess.TakeMissing", 
     495           "orange.Preprocessor_takeMissingClasses": "Orange.data.preprocess.TakeMissingClasses", 
    496496 
    497497           "orange.Discretizer": "Orange.feature.discretization.Discretizer", 
     
    573573           "orngEnviron.addOrangeDirectoriesToPath": "Orange.misc.environ.add_orange_directories_to_path", 
    574574 
    575            "orngScaleData.getVariableValuesSorted": "Orange.preprocess.scaling.get_variable_values_sorted", 
    576            "orngScaleData.getVariableValueIndices": "Orange.preprocess.scaling.get_variable_value_indices", 
    577            "orngScaleData.discretizeDomain": "Orange.preprocess.scaling.discretize_domain", 
    578            "orngScaleData.orngScaleData": "Orange.preprocess.scaling.ScaleData", 
    579            "orngScaleLinProjData.orngScaleLinProjData": "Orange.preprocess.scaling.ScaleLinProjData", 
    580            "orngScalePolyvizData.orngScalePolyvizData": "Orange.preprocess.scaling.ScalePolyvizData", 
    581            "orngScaleScatterPlotData.orngScaleScatterPlotData": "Orange.preprocess.scaling.ScaleScatterPlotData", 
     575           "orngScaleData.getVariableValuesSorted": "Orange.data.preprocess.scaling.get_variable_values_sorted", 
     576           "orngScaleData.getVariableValueIndices": "Orange.data.preprocess.scaling.get_variable_value_indices", 
     577           "orngScaleData.discretizeDomain": "Orange.data.preprocess.scaling.discretize_domain", 
     578           "orngScaleData.orngScaleData": "Orange.data.preprocess.scaling.ScaleData", 
     579           "orngScaleLinProjData.orngScaleLinProjData": "Orange.data.preprocess.scaling.ScaleLinProjData", 
     580           "orngScalePolyvizData.orngScalePolyvizData": "Orange.data.preprocess.scaling.ScalePolyvizData", 
     581           "orngScaleScatterPlotData.orngScaleScatterPlotData": "Orange.data.preprocess.scaling.ScaleScatterPlotData", 
    582582 
    583583           "orngEvalAttr.mergeAttrValues": "Orange.feature.scoring.merge_values", 
  • Orange/misc/testing.py

    r10305 r10542  
    8686 
    8787import orange 
    88 from Orange.preprocess import Preprocessor_discretize, Preprocessor_continuize 
     88from Orange.data import preprocess 
    8989 
    9090TEST_CLASSIFICATION = 1 
     
    108108    dataset = orange.ExampleTable(os.path.join(datasetsdir, name)) 
    109109    if flags & CONTINUIZE_DOMAIN: 
    110         preprocessor = Preprocessor_continuize() 
     110        preprocessor = preprocess.Continuize() 
    111111        dataset = preprocessor(dataset) 
    112112    elif flags & DISCRETIZE_DOMAIN: 
    113         preprocessor = Preprocessor_discretize(method=orange.EquiNDiscretization(), 
     113        preprocessor = preprocess.Discretize(method=orange.EquiNDiscretization(), 
    114114                                               discretize_class=False) 
    115115        dataset = preprocessor(dataset) 
  • Orange/orng/orngScaleData.py

    r9671 r10542  
    1 from Orange.preprocess.scaling import get_variable_values_sorted as getVariableValuesSorted 
    2 from Orange.preprocess.scaling import get_variable_value_indices as getVariableValueIndices 
    3 from Orange.preprocess.scaling import discretize_domain as discretizeDomain 
    4 from Orange.preprocess.scaling import ScaleData as orngScaleData 
     1from Orange.data.preprocess.scaling import get_variable_values_sorted as getVariableValuesSorted 
     2from Orange.data.preprocess.scaling import get_variable_value_indices as getVariableValueIndices 
     3from Orange.data.preprocess.scaling import discretize_domain as discretizeDomain 
     4from Orange.data.preprocess.scaling import ScaleData as orngScaleData 
  • Orange/orng/orngScaleLinProjData.py

    r10475 r10542  
    11from orngScaleData import * 
    2 from Orange.preprocess.scaling import ScaleLinProjData as orngScaleLinProjData 
    3 from Orange.preprocess.scaling import graph_deprecator 
     2from Orange.data.preprocess.scaling import ScaleLinProjData as orngScaleLinProjData 
     3from Orange.data.preprocess.scaling import graph_deprecator 
  • Orange/orng/orngScalePolyvizData.py

    r9671 r10542  
    11from orngScaleLinProjData import * 
    2 from Orange.preprocess.scaling import ScalePolyvizData as orngScalePolyvizData 
     2from Orange.data.preprocess.scaling import ScalePolyvizData as orngScalePolyvizData 
  • Orange/orng/orngScaleScatterPlotData.py

    r9671 r10542  
    11from orngScaleData import * 
    2 from Orange.preprocess.scaling import ScaleScatterPlotData as orngScaleScatterPlotData 
     2from Orange.data.preprocess.scaling import ScaleScatterPlotData as orngScaleScatterPlotData 
  • Orange/orng/orngVizRank.py

    r9671 r10542  
    114114                graph.normalize_examples = 1 
    115115            elif visualizationMethod == SCATTERPLOT3D: 
    116                 from Orange.preprocess.scaling import ScaleScatterPlotData3D 
     116                from Orange.data.preprocess.scaling import ScaleScatterPlotData3D 
    117117                graph = ScaleScatterPlotData3D() 
    118118            elif visualizationMethod == SPHEREVIZ3D: 
    119                 from Orange.preprocess.scaling import ScaleLinProjData3D 
     119                from Orange.data.preprocess.scaling import ScaleLinProjData3D 
    120120                graph = ScaleLinProjData3D() 
    121121                graph.normalize_examples = 1 
    122122            elif visualizationMethod == LINEAR_PROJECTION3D: 
    123                 from Orange.preprocess.scaling import ScaleLinProjData3D 
     123                from Orange.data.preprocess.scaling import ScaleLinProjData3D 
    124124                graph = ScaleLinProjData3D() 
    125125                graph.normalize_examples = 0 
  • Orange/projection/linear.py

    r10490 r10542  
    88import numpy 
    99 
    10 from Orange.preprocess.scaling import ScaleLinProjData 
     10from Orange.data.preprocess.scaling import ScaleLinProjData 
    1111from Orange.orng import orngVisFuncts as visfuncts 
    1212from Orange.misc import deprecated_keywords 
  • Orange/regression/earth.py

    r10420 r10542  
    5555from Orange.feature import Discrete, Continuous 
    5656from Orange.data import Table, Domain 
    57 from Orange.preprocess import Preprocessor_continuize, \ 
    58                               Preprocessor_impute, \ 
    59                               Preprocessor_preprocessorList, \ 
     57from Orange.data.preprocess import Continuize as Preprocessor_continuize, \ 
     58                              Impute as Preprocessor_impute, \ 
     59                              PreprocessorList as Preprocessor_preprocessorList, \ 
    6060                              DomainContinuizer 
    6161 
  • Orange/testing/unit/tests/test_preprocessors.py

    r10278 r10542  
    44    import unittest 
    55 
    6 from Orange.preprocess import (Preprocessor_addCensorWeight, 
    7          Preprocessor_addClassNoise, 
    8          Preprocessor_addClassWeight, 
    9          Preprocessor_addGaussianClassNoise, 
    10          Preprocessor_addGaussianNoise, 
    11          Preprocessor_addMissing, 
    12          Preprocessor_addMissingClasses, 
    13          Preprocessor_addNoise, 
    14          Preprocessor_discretize, 
    15          Preprocessor_drop, 
    16          Preprocessor_dropMissing, 
    17          Preprocessor_dropMissingClasses, 
    18          Preprocessor_filter, 
    19          Preprocessor_ignore, 
    20          Preprocessor_imputeByLearner, 
    21          Preprocessor_removeDuplicates, 
    22          Preprocessor_select, 
    23          Preprocessor_shuffle, 
    24          Preprocessor_take, 
    25          Preprocessor_takeMissing, 
    26          Preprocessor_takeMissingClasses, 
    27          Preprocessor_discretizeEntropy, 
    28          Preprocessor_removeContinuous, 
    29          Preprocessor_removeDiscrete, 
    30          Preprocessor_continuize, 
    31          Preprocessor_impute, 
    32          Preprocessor_featureSelection, 
    33          Preprocessor_RFE, 
    34          Preprocessor_sample, 
    35          Preprocessor_preprocessorList, 
     6from Orange.data.preprocess import (AddCensorWeight as Preprocessor_addCensorWeight, 
     7         AddClassNoise as  Preprocessor_addClassNoise, 
     8         AddClassWeight as Preprocessor_addClassWeight, 
     9         AddGaussianClassNoise as  Preprocessor_addGaussianClassNoise, 
     10         AddGaussianNoise as Preprocessor_addGaussianNoise, 
     11         AddMissing as Preprocessor_addMissing, 
     12         AddMissingClasses as Preprocessor_addMissingClasses, 
     13         AddNoise as Preprocessor_addNoise, 
     14         Discretize as Preprocessor_discretize, 
     15         Drop as Preprocessor_drop, 
     16         DropMissing as Preprocessor_dropMissing, 
     17         DropMissingClasses as Preprocessor_dropMissingClasses, 
     18         Filter as Preprocessor_filter, 
     19         Ignore as Preprocessor_ignore, 
     20         ImputeByLearner as Preprocessor_imputeByLearner, 
     21         RemoveDuplicates as Preprocessor_removeDuplicates, 
     22         Select as Preprocessor_select, 
     23         Shuffle as Preprocessor_shuffle, 
     24         Take as Preprocessor_take, 
     25         TakeMissing as Preprocessor_takeMissing, 
     26         TakeMissingClasses as Preprocessor_takeMissingClasses, 
     27         DiscretizeEntropy as Preprocessor_discretizeEntropy, 
     28         RemoveContinuous as Preprocessor_removeContinuous, 
     29         RemoveDiscrete as Preprocessor_removeDiscrete, 
     30         Continuize as Preprocessor_continuize, 
     31         Impute as Preprocessor_impute, 
     32         FeatureSelection as Preprocessor_featureSelection, 
     33         RFE as Preprocessor_RFE, 
     34         Sample as Preprocessor_sample, 
     35         PreprocessorList as Preprocessor_preprocessorList, 
    3636         ) 
    3737 
  • docs/reference/rst/Orange.data.preprocess.rst

    r10053 r10542  
    33############################## 
    44 
    5 .. automodule:: Orange.preprocess 
     5.. automodule:: Orange.data.preprocess 
    66 
    7 .. automodule:: Orange.preprocess.scaling 
     7.. autoclass:: DiscretizeEntropy(method=Orange.feature.discretization.Entropy()) 
     8 
     9.. autoclass:: RemoveContinuous 
     10 
     11.. autoclass:: Continuize 
     12 
     13.. autoclass:: RemoveDiscrete 
     14 
     15.. autoclass:: Impute 
     16 
     17.. autoclass:: FeatureSelection(measure=Orange.feature.scoring.Relief(), filter=None, limit=10) 
     18 
     19.. autofunction:: bestP 
     20 
     21.. autofunction:: bestN 
     22 
     23.. autofunction:: selectNRandom 
     24 
     25.. autofunction:: selectPRandom 
     26 
     27.. autoclass:: RFE 
     28 
     29.. autoclass:: Sample 
     30 
     31.. autoclass:: PreprocessorList 
     32 
     33.. class:: RemoveUnusedValues(variable, data, remove_one_valued=False) 
     34 
     35    Removes unused values and reduces the variable, if a variable 
     36    declares values that do not appear in the data. 
     37 
     38    :param variable: :obj:`~Orange.feature.Descriptor` 
     39    :param data: :obj:`~Orange.data.Table` 
     40    :param remove_one_valued: Decides whether to remove or to retain 
     41        the attributes with only one value defined (default: False). 
     42 
     43    Example: 
     44 
     45    .. literalinclude:: code/unusedValues.py 
     46 
     47    There are four possible outcomes: 
     48 
     49    1. The variable does not have any used values in the data - value 
     50    of this variable is undefined for all examples. The variable is 
     51    thus useless and the class returns None. 
     52 
     53    2. The variable has only one used value (or, possibly, only one 
     54    value at all). Such a variable is in fact useless, and can 
     55    probably be removed without harm. Nevertheless, its fate is 
     56    decided by the flag remove_one_valued which is False by default, 
     57    so such variables are retained unless explicitly specified 
     58    otherwise. 
     59 
     60    3. All variable's values occur in the data (and the variable has more 
     61    than one value; otherwise the above case applies). The original variable 
     62    is returned. 
     63 
     64    4. There are some unused values. A new variable is constructed and the 
     65    unused values are omitted. The value of the new variable is computed 
     66    automatically from the value of the original variable 
     67    :class:`~Orange.classification.lookup.ClassifierByLookupTable` is used 
     68    for mapping. 
     69 
     70    Results of example: 
     71 
     72    .. literalinclude:: code/unusedValues.res 
     73 
     74    Variables a and y are OK and are left alone. In b, value 1 is not used 
     75    and is removed (not in the original variable, of course; a new variable 
     76    is created). c is useless and is removed altogether. d is retained since 
     77    remove_one_valued was left at False; if we set it to True, this variable 
     78    would be removed as well. 
     79 
     80 
     81.. automodule:: Orange.data.preprocess.scaling 
Note: See TracChangeset for help on using the changeset viewer.