weka_alias.py 8.39 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
"""
    List of alias for classifiers available on python-weka-wrapper.
    
    Name: weka_alias.py
    Author: Alessandro dos Santos Ferreira ( santosferreira.alessandro@gmail.com )
"""

from interface.interface import InterfaceException as IException

_weka_alias = {    
    
    ### Bayes 
    "AODE": "weka.classifiers.bayes.AODE",
    "AODEsr": "weka.classifiers.bayes.AODEsr",
    "BayesianLogisticRegression": "weka.classifiers.bayes.BayesianLogisticRegression",
    "BayesNet": "weka.classifiers.bayes.BayesNet",
    "ComplementNaiveBayes": "weka.classifiers.bayes.ComplementNaiveBayes",
    "DMNBtext": "weka.classifiers.bayes.DMNBtext",
    "HNB": "weka.classifiers.bayes.HNB",
    "NaiveBayes": "weka.classifiers.bayes.NaiveBayes",
    "NaiveBayesMultinomial": "weka.classifiers.bayes.NaiveBayesMultinomial",
    "NaiveBayesMultinomialUpdateable": "weka.classifiers.bayes.NaiveBayesMultinomialUpdateable",
    "NaiveBayesMultinomialText": "weka.classifiers.bayes.NaiveBayesMultinomialText",
    "NaiveBayesSimple": "weka.classifiers.bayes.NaiveBayesSimple",
    "NaiveBayesUpdateable": "weka.classifiers.bayes.NaiveBayesUpdateable",
    "WAODE": "weka.classifiers.bayes.WAODE",

    ### Functions
    "GaussianProcesses": "weka.classifiers.functions.GaussianProcesses",
    "IsotonicRegression": "weka.classifiers.functions.IsotonicRegression",
    "LeastMedSq": "weka.classifiers.functions.LeastMedSq",
    "LibLINEAR": "weka.classifiers.functions.LibLINEAR",
    "LibSVM": "weka.classifiers.functions.LibSVM",
    "LinearRegression": "weka.classifiers.functions.LinearRegression",
    "Logistic": "weka.classifiers.functions.Logistic",
    "MLPClassifier": "weka.classifiers.functions.MLPClassifier",
    "MLPRegressor": "weka.classifiers.functions.MLPRegressor",
    "MultilayerPerceptron": "weka.classifiers.functions.MultilayerPerceptron",
    "NonNegativeLogisticRegression": "weka.classifiers.functions.NonNegativeLogisticRegression",
    "PaceRegression": "weka.classifiers.functions.PaceRegression",
    "PLSClassifier": "weka.classifiers.functions.PLSClassifier",
    "RBFNetwork": "weka.classifiers.functions.RBFNetwork",
    "RBFClassifier": "weka.classifiers.functions.RBFClassifier",
    "RBFRegressor": "weka.classifiers.functions.RBFRegressor",
    "SimpleLinearRegression": "weka.classifiers.functions.SimpleLinearRegression",
    "SimpleLogistic": "weka.classifiers.functions.SimpleLogistic",
    "SGD": "weka.classifiers.functions.SGD",
    "SGDText": "weka.classifiers.functions.SGDText",
    "SMO": "weka.classifiers.functions.SMO",
    "SMOreg": "weka.classifiers.functions.SMOreg",
    "SPegasos": "weka.classifiers.functions.SPegasos",
    "SVMreg": "weka.classifiers.functions.SVMreg",
    "VotedPerceptron": "weka.classifiers.functions.VotedPerceptron",
    "Winnow": "weka.classifiers.functions.Winnow",
    
    ### Lazy
    "IB1": "weka.classifiers.lazy.IB1",
    "IBk": "weka.classifiers.lazy.IBk",
    "KStar": "weka.classifiers.lazy.KStar",
    "LBR": "weka.classifiers.lazy.LBR",
    "LWL": "weka.classifiers.lazy.LWL",
    
    # Meta
    "AdaBoostM1": "weka.classifiers.meta.AdaBoostM1",
    "AdditiveRegression": "weka.classifiers.meta.AdditiveRegression",
    "AttributeSelectedClassifier": "weka.classifiers.meta.AttributeSelectedClassifier",
    "Bagging": "weka.classifiers.meta.Bagging",
    "ClassificationViaClustering": "weka.classifiers.meta.ClassificationViaClustering",
    "ClassificationViaRegression": "weka.classifiers.meta.ClassificationViaRegression",
    "CostSensitiveClassifier": "weka.classifiers.meta.CostSensitiveClassifier",
    "CVParameterSelection": "weka.classifiers.meta.CVParameterSelection",
    "Dagging": "weka.classifiers.meta.Dagging",
    "Decorate": "weka.classifiers.meta.Decorate",
    "END": "weka.classifiers.meta.END",
    "EnsembleSelection": "weka.classifiers.meta.EnsembleSelection",
    "FilteredClassifier": "weka.classifiers.meta.FilteredClassifier",
    "Grading": "weka.classifiers.meta.Grading",
    "GridSearch": "weka.classifiers.meta.GridSearch",
    "LogitBoost": "weka.classifiers.meta.LogitBoost",
    "MetaCost": "weka.classifiers.meta.MetaCost",
    "MultiBoostAB": "weka.classifiers.meta.MultiBoostAB",
    "MultiClassClassifier": "weka.classifiers.meta.MultiClassClassifier",
    "MultiClassClassifierUpdateable": "weka.classifiers.meta.MultiClassClassifierUpdateable",
    "MultiScheme": "weka.classifiers.meta.MultiScheme",
    "OneClassClassifier": "weka.classifiers.meta.OneClassClassifier",
    "OrdinalClassClassifier": "weka.classifiers.meta.OrdinalClassClassifier",
    "RacedIncrementalLogitBoost": "weka.classifiers.meta.RacedIncrementalLogitBoost",
    "RandomCommittee": "weka.classifiers.meta.RandomCommittee",
    "RandomSubSpace": "weka.classifiers.meta.RandomSubSpace",
    "RealAdaBoost": "weka.classifiers.meta.RealAdaBoost",
    "RegressionByDiscretization": "weka.classifiers.meta.RegressionByDiscretization",
    "RotationForest": "weka.classifiers.meta.RotationForest",
    "Stacking": "weka.classifiers.meta.Stacking",
    "StackingC": "weka.classifiers.meta.StackingC",
    "ThresholdSelector": "weka.classifiers.meta.ThresholdSelector",
    "Vote": "weka.classifiers.meta.Vote",
    "ClassBalancedND": "weka.classifiers.meta.ClassBalancedND",
    "DataNearBalancedND": "weka.classifiers.meta.DataNearBalancedND",
    "ND": "weka.classifiers.meta.ND",

    ### Miscellaneous
    "HyperPipes": "weka.classifiers.misc.sc.HyperPipes",
    "InputMappedClassifier": "weka.classifiers.misc.sc.InputMappedClassifier",
    "MinMaxExtension": "weka.classifiers.misc.sc.MinMaxExtension",
    "OLM": "weka.classifiers.misc.sc.OLM",
    "OSDL": "weka.classifiers.misc.sc.OSDL",
    "SerializedClassifier": "weka.classifiers.misc.sc.SerializedClassifier",
    "VFI": "weka.classifiers.misc.sc.VFI",
    
    ### Multi-instance
    "CitationKNN": "weka.classifiers.mi.CitationKNN",
    "MDD": "weka.classifiers.mi.MDD",
    "MIBoost": "weka.classifiers.mi.MIBoost",
    "MIDD": "weka.classifiers.mi.MIDD",
    "MIEMDD": "weka.classifiers.mi.MIEMDD",
    "MILR": "weka.classifiers.mi.MILR",
    "MINND": "weka.classifiers.mi.MINND",
    "MIOptimalBall": "weka.classifiers.mi.MIOptimalBall",
    "MIRI": "weka.classifiers.mi.MIRI",
    "MISMO": "weka.classifiers.mi.MISMO",
    "MISVM": "weka.classifiers.mi.MISVM",
    "MITI": "weka.classifiers.mi.MITI",
    "MIWrapper": "weka.classifiers.mi.MIWrapper",
    "SimpleMI": "weka.classifiers.mi.SimpleMI",
    "TLD": "weka.classifiers.mi.TLD",
    "TLDSimple": "weka.classifiers.mi.TLDSimple",

    ### Rules
    "ConjunctiveRule": "weka.classifiers.rules.ConjunctiveRule",
    "DecisionTable": "weka.classifiers.rules.DecisionTable",
    "DTNB": "weka.classifiers.rules.DTNB",
    "FURIA": "weka.classifiers.rules.FURIA",
    "JRip": "weka.classifiers.rules.JRip",
    "M5Rules": "weka.classifiers.rules.M5Rules",
    "NNge": "weka.classifiers.rules.NNge",
    "OneR": "weka.classifiers.rules.OneR",
    "PART": "weka.classifiers.rules.PART",
    "Prism": "weka.classifiers.rules.Prism",
    "Ridor": "weka.classifiers.rules.Ridor",
    "ZeroR": "weka.classifiers.rules.ZeroR",
    
    ### Trees
    "ADTree": "weka.classifiers.trees.ADTree",
    "BFTree": "weka.classifiers.trees.BFTree",
    "DecisionStump": "weka.classifiers.trees.DecisionStump",
    "ExtraTree": "weka.classifiers.trees.ExtraTree",
    "FT": "weka.classifiers.trees.FT",
    "HoeffdingTree": "weka.classifiers.trees.HoeffdingTree",
    "Id3": "weka.classifiers.trees.Id3",
    "J48": "weka.classifiers.trees.J48",
    "J48graft": "weka.classifiers.trees.J48graft",
    "LADTree": "weka.classifiers.trees.LADTree",
    "LMT": "weka.classifiers.trees.LMT",
    "M5P": "weka.classifiers.trees.M5P",
    "NBTree": "weka.classifiers.trees.NBTree",
    "RandomForest": "weka.classifiers.trees.RandomForest",
    "RandomTree": "weka.classifiers.trees.RandomTree",
    "REPTree": "weka.classifiers.trees.REPTree",
    "SimpleCart": "weka.classifiers.trees.SimpleCart",
    "UserClassifier": "weka.classifiers.trees.UserClassifier"

}

class WekaAlias(object): 
    
    @staticmethod
    def get_classifier(name):        
        classifiers = [_weka_alias[alias] for alias in _weka_alias]
        
        if name in classifiers:
            return name
        
        alias = name.upper().strip()
        aliases = [a.upper() for a in _weka_alias]
        
        if alias in aliases:
            return _weka_alias.values()[ aliases.index(alias) ]
        
        raise IException('Invalid classifier')