Search in sources :

Example 1 with MarginPerceptron

use of edu.cmu.minorthird.classify.algorithms.linear.MarginPerceptron in project lucida by claritylab.

the class HierarchicalClassifierTrainer method createLearnerByName.

public ClassifierLearner createLearnerByName(String name) {
    ClassifierLearner learner;
    //K-Nearest-Neighbor learner, using m3rd recommended parameters
    if (name.equalsIgnoreCase("KNN")) {
        learner = new KnnLearner();
    } else //K-Way Mixture learner, using m3rd recommended parameters
    if (name.equalsIgnoreCase("KWAY_MIX")) {
        learner = new KWayMixtureLearner();
    } else //Maximum Entropy learner, using m3rd recommended parameters
    if (name.equalsIgnoreCase("MAX_ENT")) {
        learner = new MaxEntLearner();
    } else //Balanced Winnow learner with One vs All binary transformer, using m3rd recommended parameters
    if (name.equalsIgnoreCase("BWINNOW_OVA")) {
        learner = new OneVsAllLearner(new BalancedWinnow());
    } else //Margin Perceptron learner with One vs All binary transformer, using m3rd recommended parameters
    if (name.equalsIgnoreCase("MPERCEPTRON_OVA")) {
        learner = new OneVsAllLearner(new MarginPerceptron());
    } else //Naive Bayes learner with One vs All binary transformer, using m3rd recommended parameters
    if (name.equalsIgnoreCase("NBAYES_OVA")) {
        learner = new OneVsAllLearner(new NaiveBayes());
    } else //Voted Perceptron learner with One vs All binary transformer, using m3rd recommended parameters
    if (name.equalsIgnoreCase("VPERCEPTRON_OVA")) {
        learner = new OneVsAllLearner(new VotedPerceptron());
    } else //Ada Boost learner with One vs All binary transformer, using m3rd recommended parameters
    if (name.equalsIgnoreCase("ADABOOST_OVA")) {
        learner = new OneVsAllLearner(new AdaBoost());
    } else //Ada Boost learner with Cascading binary transformer, using m3rd recommended parameters
    if (name.equalsIgnoreCase("ADABOOST_CB")) {
        learner = new CascadingBinaryLearner(new AdaBoost());
    } else //Ada Boost learner with Most Frequent First binary transformer, using m3rd recommended parameters
    if (name.equalsIgnoreCase("ADABOOST_MFF")) {
        learner = new MostFrequentFirstLearner(new AdaBoost());
    } else //Ada Boost learner (Logistic Regression version) with One vs All binary transformer, using m3rd recommended parameters
    if (name.equalsIgnoreCase("ADABOOSTL_OVA")) {
        learner = new OneVsAllLearner(new AdaBoost.L());
    } else //Ada Boost learner (Logistic Regression version) with Cascading binary transformer, using m3rd recommended parameters
    if (name.equalsIgnoreCase("ADABOOSTL_CB")) {
        learner = new CascadingBinaryLearner(new AdaBoost.L());
    } else //Ada Boost learner (Logistic Regression version) with Most Frequent First binary transformer, using m3rd recommended parameters
    if (name.equalsIgnoreCase("ADABOOSTL_MFF")) {
        learner = new MostFrequentFirstLearner(new AdaBoost.L());
    } else //Decision Tree learner with One vs All binary transformer, using m3rd recommended parameters
    if (name.equalsIgnoreCase("DTREE_OVA")) {
        learner = new OneVsAllLearner(new DecisionTreeLearner());
    } else //Decision Tree learner with Cascading binary transformer, using m3rd recommended parameters
    if (name.equalsIgnoreCase("DTREE_CB")) {
        learner = new CascadingBinaryLearner(new DecisionTreeLearner());
    } else //Decision Tree learner with Most Frequent First binary transformer, using m3rd recommended parameters
    if (name.equalsIgnoreCase("DTREE_MFF")) {
        learner = new MostFrequentFirstLearner(new DecisionTreeLearner());
    } else //Negative Binomial learner with One vs All binary transformer, using m3rd recommended parameters
    if (name.equalsIgnoreCase("NEGBI_OVA")) {
        learner = new OneVsAllLearner(new NegativeBinomialLearner());
    } else //Negative Binomial learner with Cascading binary transformer, using m3rd recommended parameters
    if (name.equalsIgnoreCase("NEGBI_CB")) {
        learner = new CascadingBinaryLearner(new NegativeBinomialLearner());
    } else //Negative Binomial learner with Most Frequent First binary transformer, using m3rd recommended parameters
    if (name.equalsIgnoreCase("NEGBI_MFF")) {
        learner = new MostFrequentFirstLearner(new NegativeBinomialLearner());
    } else //SVM learner with One vs All binary transformer, using m3rd recommended parameters
    if (name.equalsIgnoreCase("SVM_OVA")) {
        learner = new OneVsAllLearner(new SVMLearner());
    } else //SVM learner with One vs All binary transformer, using testing parameters
    if (name.equalsIgnoreCase("SVM_OVA_CONF1")) {
        svm_parameter param = new svm_parameter();
        param.svm_type = svm_parameter.C_SVC;
        param.kernel_type = svm_parameter.POLY;
        param.degree = 2;
        // 1/k
        param.gamma = 1;
        param.coef0 = 0;
        param.nu = 0.5;
        param.cache_size = 40;
        param.C = 1;
        param.eps = 1e-3;
        param.p = 0.1;
        param.shrinking = 1;
        param.nr_weight = 0;
        param.weight_label = new int[0];
        param.weight = new double[0];
        learner = new OneVsAllLearner(new SVMLearner(param));
    } else //SVM learner with Cascading binary transformer, using m3rd recommended parameters
    if (name.equalsIgnoreCase("SVM_CB")) {
        learner = new CascadingBinaryLearner(new SVMLearner());
    } else //SVM learner with Most Frequent First binary transformer, using m3rd recommended parameters
    if (name.equalsIgnoreCase("SVM_MFF")) {
        learner = new MostFrequentFirstLearner(new SVMLearner());
    } else {
        System.err.println("Unrecognized learner name: " + name);
        learner = null;
    }
    return learner;
}
Also used : MarginPerceptron(edu.cmu.minorthird.classify.algorithms.linear.MarginPerceptron) DecisionTreeLearner(edu.cmu.minorthird.classify.algorithms.trees.DecisionTreeLearner) SVMLearner(edu.cmu.minorthird.classify.algorithms.svm.SVMLearner) KWayMixtureLearner(edu.cmu.minorthird.classify.algorithms.linear.KWayMixtureLearner) libsvm.svm_parameter(libsvm.svm_parameter) KnnLearner(edu.cmu.minorthird.classify.algorithms.knn.KnnLearner) NegativeBinomialLearner(edu.cmu.minorthird.classify.algorithms.linear.NegativeBinomialLearner) BalancedWinnow(edu.cmu.minorthird.classify.algorithms.linear.BalancedWinnow) MaxEntLearner(edu.cmu.minorthird.classify.algorithms.linear.MaxEntLearner) VotedPerceptron(edu.cmu.minorthird.classify.algorithms.linear.VotedPerceptron) ClassifierLearner(edu.cmu.minorthird.classify.ClassifierLearner) NaiveBayes(edu.cmu.minorthird.classify.algorithms.linear.NaiveBayes) AdaBoost(edu.cmu.minorthird.classify.algorithms.trees.AdaBoost) OneVsAllLearner(edu.cmu.minorthird.classify.OneVsAllLearner) MostFrequentFirstLearner(edu.cmu.minorthird.classify.MostFrequentFirstLearner) CascadingBinaryLearner(edu.cmu.minorthird.classify.CascadingBinaryLearner)

Aggregations

CascadingBinaryLearner (edu.cmu.minorthird.classify.CascadingBinaryLearner)1 ClassifierLearner (edu.cmu.minorthird.classify.ClassifierLearner)1 MostFrequentFirstLearner (edu.cmu.minorthird.classify.MostFrequentFirstLearner)1 OneVsAllLearner (edu.cmu.minorthird.classify.OneVsAllLearner)1 KnnLearner (edu.cmu.minorthird.classify.algorithms.knn.KnnLearner)1 BalancedWinnow (edu.cmu.minorthird.classify.algorithms.linear.BalancedWinnow)1 KWayMixtureLearner (edu.cmu.minorthird.classify.algorithms.linear.KWayMixtureLearner)1 MarginPerceptron (edu.cmu.minorthird.classify.algorithms.linear.MarginPerceptron)1 MaxEntLearner (edu.cmu.minorthird.classify.algorithms.linear.MaxEntLearner)1 NaiveBayes (edu.cmu.minorthird.classify.algorithms.linear.NaiveBayes)1 NegativeBinomialLearner (edu.cmu.minorthird.classify.algorithms.linear.NegativeBinomialLearner)1 VotedPerceptron (edu.cmu.minorthird.classify.algorithms.linear.VotedPerceptron)1 SVMLearner (edu.cmu.minorthird.classify.algorithms.svm.SVMLearner)1 AdaBoost (edu.cmu.minorthird.classify.algorithms.trees.AdaBoost)1 DecisionTreeLearner (edu.cmu.minorthird.classify.algorithms.trees.DecisionTreeLearner)1 libsvm.svm_parameter (libsvm.svm_parameter)1