Ignore:
Timestamp:
02/06/12 01:18:36 (2 years ago)
Author:
Miha Stajdohar <miha.stajdohar@…>
Branch:
default
rebase_source:
4883f2ba8f687f3abacdcab7da21b8a4207fba86
Message:

New names in feature.selection.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orange/fixes/fix_changed_names.py

    r9649 r9654  
    4848 
    4949           "orange.newmetaid": "Orange.data.new_meta_id", 
    50             
     50 
    5151           "orange.Distribution": "Orange.statistics.distribution.Distribution", 
    5252           "orange.DiscDistribution": "Orange.statistics.distribution.Discrete", 
     
    5454           "orange.GaussianDistribution": "Orange.statistics.distribution.Gaussian", 
    5555           "orange.DomainDistributions": "Orange.statistics.distribution.Domain", 
    56             
     56 
    5757           "orange.BasicAttrStat": "Orange.statistics.basic.Variable", 
    5858           "orange.DomainBasicAttrStat": "Orange.statistics.basic.Domain", 
    59             
     59 
    6060           "orange.ContingencyAttrAttr": "Orange.statistics.contingency.VarVar", 
    6161           "orange.ContingencyClass": "Orange.statistics.contingency.Class", 
     
    6464           "orange.DomainContingency": "Orange.statistics.contingency.Domain", 
    6565           "orange.Contingency": "Orange.statistics.contingency.Table", 
    66            
    67            "orange.MeasureAttribute": "Orange.feature.scoring.Score",  
    68            "orange.MeasureAttributeFromProbabilities": "Orange.feature.scoring.ScoreFromProbabilities",  
     66 
     67           "orange.MeasureAttribute": "Orange.feature.scoring.Score", 
     68           "orange.MeasureAttributeFromProbabilities": "Orange.feature.scoring.ScoreFromProbabilities", 
    6969           "orange.MeasureAttribute_gainRatio": "Orange.feature.scoring.GainRatio", 
    7070           "orange.MeasureAttribute_relief": "Orange.feature.scoring.Relief", 
     
    7777 
    7878           "orngFSS.attMeasure": "Orange.feature.scoring.score_all", 
    79            "orngFSS.bestNAtts": "Orange.feature.selection.bestNAtts", 
    80            "orngFSS.attsAbovethreshold": "Orange.feature.selection.attsAbovethreshold", 
    81            "orngFSS.selectBestNAtts": "Orange.feature.selection.selectBestNAtts", 
    82            "orngFSS.selectAttsAboveThresh": "Orange.feature.selection.selectAttsAboveThresh", 
    83            "orngFSS.filterRelieff": "Orange.feature.selection.filterRelieff", 
    84            "orngFSS.FilterAttsAboveThresh": "Orange.feature.selection.FilterAttsAboveThresh", 
    85            "orngFSS.FilterAttsAboveThresh_Class": "Orange.feature.selection.FilterAttsAboveThresh_Class", 
    86            "orngFSS.FilterBestNAtts": "Orange.feature.selection.FilterBestNAtts", 
    87            "orngFSS.FilterBestNAtts_Class": "Orange.feature.selection.FilterBestNAtts_Class", 
     79           "orngFSS.bestNAtts": "Orange.feature.selection.best_n", 
     80           "orngFSS.attsAbovethreshold": "Orange.feature.selection.above_threshold", 
     81           "orngFSS.selectBestNAtts": "Orange.feature.selection.select_best_n", 
     82           "orngFSS.selectAttsAboveThresh": "Orange.feature.selection.select_above_threshold", 
     83           "orngFSS.filterRelieff": "Orange.feature.selection.select_relief", 
     84           "orngFSS.FilterAttsAboveThresh": "Orange.feature.selection.FilterAboveThreshold", 
     85           "orngFSS.FilterAttsAboveThresh_Class": "Orange.feature.selection.FilterAboveThreshold", 
     86           "orngFSS.FilterBestNAtts": "Orange.feature.selection.FilterBestN", 
     87           "orngFSS.FilterBestNAtts_Class": "Orange.feature.selection.FilterBestN", 
    8888           "orngFSS.FilterRelief": "Orange.feature.selection.FilterRelief", 
    89            "orngFSS.FilterRelief_Class": "Orange.feature.selection.FilterRelief_Class", 
     89           "orngFSS.FilterRelief_Class": "Orange.feature.selection.FilterRelief", 
    9090           "orngFSS.FilteredLearner": "Orange.feature.selection.FilteredLearner", 
    91            "orngFSS.FilteredLearner_Class": "Orange.feature.selection.FilteredLearner_Class", 
     91           "orngFSS.FilteredLearner_Class": "Orange.feature.selection.FilteredLearner", 
    9292           "orngFSS.FilteredClassifier": "Orange.feature.selection.FilteredClassifier", 
    9393           "orngFSS.StepwiseLearner_Class": "Orange.classification.wrappers.StepwiseLearner", 
    9494           "orngFSS.StepwiseLearner": "Orange.classification.wrappers.StepwiseLearner", 
    95             
     95 
    9696           "orange.ImputerConstructor_model": "Orange.feature.imputation.ImputerConstructor_model", 
    9797           "orange.Imputer_model": "Orange.feature.imputation.Imputer_model", 
    9898           "orange.Imputer_defaults": "Orange.feature.imputation.Imputer_defaults", 
    9999           "orange.ImputerConstructor_asValue": "Orange.feature.imputation.ImputerConstructor_asValue", 
    100            "orange.ImputerConstructor_minimal": "Orange.feature.imputation.ImputerConstructor_minimal",  
     100           "orange.ImputerConstructor_minimal": "Orange.feature.imputation.ImputerConstructor_minimal", 
    101101           "orange.ImputerConstructor_maximal": "Orange.feature.imputation.ImputerConstructor_maximal", 
    102102           "orange.ImputerConstructor_average": "Orange.feature.imputation.ImputerConstructor_average", 
    103   
     103 
    104104           "orange.ExamplesDistance_Normalized": "Orange.distance.instances.ExamplesDistance_Normalized", 
    105105           "orange.ExamplesDistanceConstructor": "Orange.distance.instances.ExamplesDistanceConstructor", 
    106106           "orange.ExamplesDistance_Hamming": "Orange.distance.instances.Hamming", 
    107            "orange.ExamplesDistance_DTW": "Orange.distance.instances.DTW",  
    108            "orange.ExamplesDistance_Euclidean": "Orange.distance.instances.Euclidean",  
    109            "orange.ExamplesDistance_Manhattan": "Orange.distance.instances.Manhattan",  
    110            "orange.ExamplesDistance_Maximal": "Orange.distance.instances.Maximal",  
    111            "orange.ExamplesDistance_Relief": "Orange.distance.instances.Relief",  
    112             
    113            "orange.ExamplesDistanceConstructor_DTW": "Orange.distance.instances.DTWConstructor",  
    114            "orange.ExamplesDistanceConstructor_Euclidean": "Orange.distance.instances.EuclideanConstructor",  
     107           "orange.ExamplesDistance_DTW": "Orange.distance.instances.DTW", 
     108           "orange.ExamplesDistance_Euclidean": "Orange.distance.instances.Euclidean", 
     109           "orange.ExamplesDistance_Manhattan": "Orange.distance.instances.Manhattan", 
     110           "orange.ExamplesDistance_Maximal": "Orange.distance.instances.Maximal", 
     111           "orange.ExamplesDistance_Relief": "Orange.distance.instances.Relief", 
     112 
     113           "orange.ExamplesDistanceConstructor_DTW": "Orange.distance.instances.DTWConstructor", 
     114           "orange.ExamplesDistanceConstructor_Euclidean": "Orange.distance.instances.EuclideanConstructor", 
    115115           "orange.ExamplesDistanceConstructor_Hamming": "Orange.distance.instances.HammingConstructor", 
    116116           "orange.ExamplesDistanceConstructor_Manhattan": "Orange.distance.instances.ManhattanConstructor", 
    117117           "orange.ExamplesDistanceConstructor_Maximal": "Orange.distance.instances.MaximalConstructor", 
    118118           "orange.ExamplesDistanceConstructor_Relief": "Orange.distance.instances.ReliefConstructor", 
    119             
     119 
    120120           "orngClustering.ExamplesDistanceConstructor_PearsonR": "Orange.distance.instances.PearsonRConstructor", 
    121121           "orngClustering.ExamplesDistance_PearsonR": "Orange.distance.instances.PearsonR", 
    122122           "orngClustering.ExamplesDistanceConstructor_SpearmanR": "Orange.distance.instances.SpearmanRConstructor", 
    123123           "orngClustering.ExamplesDistance_SpearmanR": "Orange.distance.instances.SpearmanR", 
    124             
     124 
    125125           "orngClustering.KMeans": "Orange.clustering.kmeans.Clustering", 
    126126           "orngClustering.kmeans_init_random": "Orange.clustering.kmeans.init_random", 
     
    131131           "orngClustering.score_distance_to_centroids": "Orange.clustering.kmeans.score_distance_to_centroids", 
    132132           "orngClustering.score_silhouette": "Orange.clustering.kmeans.score_silhouette", 
    133             
     133 
    134134           "orange.HierarchicalClustering": "Orange.clustering.hierarchical.HierarchicalClustering", 
    135135           "orange.HierarchicalCluster": "Orange.clustering.hierarchical.HierarchicalCluster", 
     
    143143           "orngClustering.DendrogramPlot": "Orange.clustering.hierarchical.DendrogramPlot", 
    144144           "orngClustering.DendrogramPlotPylab": "Orange.clustering.hierarchical.DendrogramPlotPylab", 
    145             
     145 
    146146           "orngSVM.RBFKernelWrapper": "Orange.classification.svm.kernels.RBFKernelWrapper", 
    147147           "orngSVM.CompositeKernelWrapper": "Orange.classification.svm.kernels.CompositeKernelWrapper", 
     
    156156           "orngSVM.SVMLearnerEasy": "Orange.classification.svm.SVMLearnerEasy", 
    157157           "orngSVM.SVMLearnerSparse": "Orange.classification.svm.SVMLearnerSparse", 
    158             
     158 
    159159           "orange.kNNLearner":"Orange.classification.knn.kNNLearner", 
    160160           "orange.kNNClassifier":"Orange.classification.knn.kNNClassifier", 
     
    162162           "orange.FindNearestConstructor_BruteForce":"Orange.classification.knn.FindNearestConstructor", 
    163163           "orange.P2NN":"Orange.classification.knn.P2NN", 
    164             
     164 
    165165           "orange.BayesLearner":"Orange.classification.bayes.NaiveLearner", 
    166166           "orange.BayesClassifier":"Orange.classification.bayes.NaiveClassifier", 
     
    168168           "orngBayes.BayesClassifier":"Orange.classification.bayes.NaiveClassifier", 
    169169           "orngBayes.printModel": "Orange.classification.bayes.printModel", 
    170             
     170 
    171171           "orngNetwork.MdsTypeClass":"Orange.network.MdsTypeClass", 
    172172           "orngNetwork.Network":"Orange.network.Network", 
     
    177177           "orange.GraphAsMatrix":"Orange.network.GraphAsMatrix", 
    178178           "orange.GraphAsTree":"Orange.network.GraphAsTree", 
    179             
     179 
    180180           "orngEnsemble.MeasureAttribute_randomForests":"Orange.ensemble.forest.ScoreFeature", 
    181             
     181 
    182182           "orange.TreeLearner": "Orange.classification.tree.TreeLearner", 
    183183           "orange.TreeClassifier": "Orange.classification.tree.TreeClassifier", 
     
    215215           "orange.TreeStopCriteria_Python":"Orange.classification.tree.StopCriteria_Python", 
    216216           "orange.TreeStopCriteria_common":"Orange.classification.tree.StopCriteria_common", 
    217             
     217 
    218218           "orngTree.printTxt": "Orange.classification.tree:TreeClassifier.dump", 
    219219           "orngTree.printTree": "Orange.classification.tree:TreeClassifier.dump", 
     
    229229           "orngTree.insertDot": "Orange.classification.tree.insert_dot", 
    230230           "orngTree.insertNum": "Orange.classification.tree.insert_num", 
    231             
     231 
    232232           "orange.MajorityLearner":"Orange.classification.majority.MajorityLearner", 
    233233           "orange.DefaultClassifier":"Orange.classification.ConstantClassifier", 
    234             
     234 
    235235           "orange.LookupLearner":"Orange.classification.lookup.LookupLearner", 
    236236           "orange.ClassifierByLookupTable":"Orange.classification.lookup.ClassifierByLookupTable", 
     
    244244           "orngLookup.lookupFromFunction":"Orange.classification.lookup.lookup_from_function", 
    245245           "orngLookup.printLookupFunction":"Orange.classification.lookup.dump_lookup_function", 
    246             
     246 
    247247           "orange.AssociationRule" : "Orange.associate.AssociationRule", 
    248248           "orange.AssociationRules" : "Orange.associate.AssociationRules", 
     
    282282           "orngCN2.add_sub_rules": "Orange.classification.rules.add_sub_rules", 
    283283           "orngCN2.CN2EVCUnorderedLearner": "Orange.classification.rules.CN2EVCUnorderedLearner", 
    284             
     284 
    285285           "orngMDS.KruskalStress": "Orange.projection.mds.KruskalStress", 
    286286           "orngMDS.SammonStress": "Orange.projection.mds.SammonStress", 
     
    291291           "orngMDS.PivotMDS": "Orange.projection.mds.PivotMDS", 
    292292           "orngMDS.MDS": "Orange.projection.mds.MDS", 
    293             
     293 
    294294           "orngStat.AP" : "Orange.evaluation.scoring.AP", 
    295295           "orngStat.AROC" : "Orange.evaluation.scoring.AROC", 
     
    389389           "orngStat.statisticsByFolds" : "Orange.evaluation.scoring.statistics_by_folds", 
    390390#           "orngStat.x" : "Orange.evaluation.scoring.x", 
    391             
     391 
    392392           # Orange.selection 
    393393           "orngMisc.BestOnTheFly":"Orange.misc.selection.BestOnTheFly", 
     
    401401           "orngMisc.compare2_bigger":"Orange.misc.selection.compare_bigger", 
    402402           "orngMisc.compare2_smaller":"Orange.misc.selection.compare_smaller", 
    403             
     403 
    404404           "orngMisc.Renderer": "Orange.misc.render.Renderer", 
    405405           "orngMisc.EPSRenderer": "Orange.misc.render.EPSRenderer", 
     
    407407           "orngMisc.PILRenderer": "Orange.misc.render.PILRenderer", 
    408408           # The rest of orngMisc is handled by fix_orange_imports (maps to Orange.misc)  
    409             
     409 
    410410           "orngEnsemble.BaggedLearner":"Orange.ensemble.bagging.BaggedLearner", 
    411411           "orngEnsemble.BaggedClassifier":"Orange.ensemble.bagging.BaggedClassifier", 
     
    455455           "orngLR.lchisqprob":"Orange.classification.logreg.lchisqprob", 
    456456           "orngLR.zprob":"Orange.classification.logreg.zprob", 
    457             
     457 
    458458           "orange.Preprocessor": "Orange.preprocess.Preprocessor", 
    459459           "orange.Preprocessor_addCensorWeight": "Orange.preprocess.Preprocessor_addCensorWeight", 
     
    478478           "orange.Preprocessor_takeMissing": "Orange.preprocess.Preprocessor_takeMissing", 
    479479           "orange.Preprocessor_takeMissingClasses": "Orange.preprocess.Preprocessor_takeMissingClasses", 
    480             
     480 
    481481           "orange.Discretizer": "Orange.feature.discretization.Discretizer", 
    482482           "orange.BiModalDiscretizer": "Orange.feature.discretization.BiModalDiscretizer", 
     
    486486           "orange.EntropyDiscretization": "Orange.feature.discretization.EntropyDiscretization", 
    487487           "orange.Discrete2Continuous": "Orange.feature.discretization.Discrete2Continuous", 
    488             
     488 
    489489           "orange.DomainContinuizer": "Orange.feature.continuization.DomainContinuizer", 
    490             
     490 
    491491           "orange.MakeRandomIndices": "Orange.data.sample.SubsetIndices", 
    492492           "orange.MakeRandomIndicesN": "Orange.data.sample.SubsetIndicesN", 
     
    514514           "orngLinProj.FreeVizLearner": "Orange.projection.linear.FreeVizLearner", 
    515515           "orngLinProj.S2NHeuristicLearner": "Orange.projection.linear.S2NHeuristicLearner", 
    516             
     516 
    517517           "orngDisc.entropyDiscretization": "Orange.feature.discretization.entropyDiscretization_wrapper", 
    518518           "orngDisc.EntropyDiscretization": "Orange.feature.discretization.EntropyDiscretization_wrapper", 
    519             
     519 
    520520           "orange.ProbabilityEstimator": "Orange.statistics.estimate.ProbabilityEstimator", 
    521521           "orange.ProbabilityEstimator_FromDistribution": "Orange.statistics.estimate.ProbabilityEstimator_FromDistribution", 
     
    527527           "orange.ProbabilityEstimatorConstructor_relative": "Orange.statistics.estimate.ProbabilityEstimatorConstructor_relative", 
    528528           "orange.ProbabilityEstimatorList": "Orange.statistics.estimate.ProbabilityEstimatorList", 
    529             
     529 
    530530           "orange.FilterList": "Orange.preprocess.FilterList", 
    531531           "orange.Filter": "Orange.preprocess.Filter", 
     
    539539           "orange.Filter_sameValue": "Orange.preprocess.Filter_sameValue", 
    540540           "orange.Filter_values": "Orange.preprocess.Filter_values", 
    541             
     541 
    542542           # orngEnviron 
    543             
     543 
    544544           "orngEnviron.orangeDir": "Orange.misc.environ.install_dir", 
    545545           "orngEnviron.orangeDocDir": "Orange.misc.environ.doc_install_dir", 
     
    560560           "orngEnviron.samepath": "Orange.misc.environ.samepath", 
    561561           "orngEnviron.addOrangeDirectoriesToPath": "Orange.misc.environ.add_orange_directories_to_path", 
    562                        
     562 
    563563           "orngScaleData.getVariableValuesSorted": "Orange.preprocess.scaling.get_variable_values_sorted", 
    564564           "orngScaleData.getVariableValueIndices": "Orange.preprocess.scaling.get_variable_value_indices", 
     
    600600        if orig != new: 
    601601            MAPPING['Orange.evaluation.testing.' + orig] = 'Orange.evaluation.testing.' + new 
    602      
     602 
    603603for k, v in MAPPING.items(): 
    604604    if k.startswith('orngStat.'): 
     
    607607        if orig != new: 
    608608            MAPPING['Orange.evaluation.scoring.' + orig] = 'Orange.evaluation.scoring.' + new 
    609      
     609 
    610610def build_pattern(mapping=MAPPING): 
    611611    PATTERN = """ 
     
    614614         tail=any* 
    615615    > 
    616     """  
     616    """ 
    617617    return PATTERN % "|".join("'%s'" % key.split(".")[-1] for key in mapping.keys()) 
    618      
     618 
    619619class FixChangedNames(fixer_base.BaseFix): 
    620     mapping = MAPPING  
    621      
     620    mapping = MAPPING 
     621 
    622622    run_order = 1 
    623      
     623 
    624624    def compile_pattern(self): 
    625625        self.PATTERN = build_pattern(self.mapping) 
    626626        self._modules_to_change = [key.split(".", 1)[0] for key in self.mapping.keys()] 
    627627        super(FixChangedNames, self).compile_pattern() 
    628          
     628 
    629629    def package_tree(self, package): 
    630630        """ Return pytree tree for accessing the package 
     
    641641            nodes.append(new) 
    642642        return nodes 
    643          
    644          
     643 
     644 
    645645    def transform(self, node, results): 
    646646        member = results.get("member") 
     
    652652            node = member[0] 
    653653            head = head[0] 
    654              
     654 
    655655            old_name = module + "." + node.value 
    656656            if old_name not in self.mapping: 
    657657                return 
    658              
     658 
    659659            new_name = unicode(self.mapping[old_name]) 
    660              
     660 
    661661            if ":" in new_name: 
    662662                # ':' is the delimiter used to separate module namespace 
    663                 package = new_name.split(":",1)[0] 
     663                package = new_name.split(":", 1)[0] 
    664664                new_name = new_name.replace(":", ".") 
    665665            else: 
    666666                package = new_name.rsplit(".", 1)[0] 
    667                  
     667 
    668668            syms = self.syms 
    669              
     669 
    670670            if tail: 
    671671                tail = [t.clone() for t in  tail] 
    672672            new = self.package_tree(new_name) 
    673673            new = pytree.Node(syms.power, new + tail, prefix=head.prefix) 
    674              
     674 
    675675            # Make sure the proper package is imported 
    676676#            if ":" in new_name: 
     
    684684            touch_import(None, orange_to_root(package), node) 
    685685            return new 
    686          
     686 
Note: See TracChangeset for help on using the changeset viewer.