Example usage for weka.classifiers.functions SMO TAGS_FILTER

List of usage examples for weka.classifiers.functions SMO TAGS_FILTER

Introduction

In this page you can find the example usage for weka.classifiers.functions SMO TAGS_FILTER.

Prototype

Tag[] TAGS_FILTER

To view the source code for weka.classifiers.functions SMO TAGS_FILTER.

Click Source Link

Document

The filter to apply to the training data

Usage

From source file:jjj.asap.sas.models1.job.BuildRBFKernelModels.java

License:Open Source License

@Override
protected void run() throws Exception {

    // validate args
    if (!Bucket.isBucket("datasets", inputBucket)) {
        throw new FileNotFoundException(inputBucket);
    }//from   w  w w .j  a  v  a2  s.  c  o  m
    if (!Bucket.isBucket("models", outputBucket)) {
        throw new FileNotFoundException(outputBucket);
    }

    // init multi-threading
    Job.startService();
    final Queue<Future<Object>> queue = new LinkedList<Future<Object>>();

    // get the input from the bucket
    List<String> names = Bucket.getBucketItems("datasets", this.inputBucket);
    for (String dsn : names) {

        SMO smo = new SMO();
        smo.setFilterType(new SelectedTag(SMO.FILTER_NONE, SMO.TAGS_FILTER));
        smo.setBuildLogisticModels(true);
        RBFKernel kernel = new RBFKernel();
        kernel.setGamma(0.05);
        smo.setKernel(kernel);

        AttributeSelectedClassifier asc = new AttributeSelectedClassifier();
        asc.setEvaluator(new InfoGainAttributeEval());
        Ranker ranker = new Ranker();
        ranker.setThreshold(0.01);
        asc.setSearch(ranker);
        asc.setClassifier(smo);

        queue.add(Job.submit(new ModelBuilder(dsn, "InfoGain-SMO-RBFKernel", asc, this.outputBucket)));
    }

    // wait on complete
    Progress progress = new Progress(queue.size(), this.getClass().getSimpleName());
    while (!queue.isEmpty()) {
        try {
            queue.remove().get();
        } catch (Exception e) {
            Job.log("ERROR", e.toString());
        }
        progress.tick();
    }
    progress.done();
    Job.stopService();

}

From source file:org.uclab.mm.icl.llc.config.RecognizerType.java

License:Apache License

/**
 * Returns the corresponding recognizer//from  w w  w . j a v  a  2  s .c om
 * @param rec recognizer type to return
 * @param userID user ID to set
 * @return instance of the corresponding recognizer
 */
public LLCRecognizer getRecognizer(long userID) {

    RecognizerType rec = this.values()[value];
    switch (rec) {
    case SER:
        String[] labels = { "Anger", "Happiness", "Sadness" };
        String path = FileUtil.getRootPath() + "/training/modeldataV2.7.txt";
        SMO svm = new SMO(); // Define Classifier with Weka
        try {
            svm.setOptions(weka.core.Utils.splitOptions(
                    "-C 1.0 -L 0.0010 -P 1.0E-12 -N 1 -V -1 -W 1 -K \"weka.classifiers.functions.supportVector.RBFKernel -C 250007 -G 0.01\""));
            svm.setFilterType(new SelectedTag(SMO.FILTER_STANDARDIZE, SMO.TAGS_FILTER));
        } catch (Exception e) {
            e.printStackTrace();
        }
        ExtClassification classifier = new ExtClassification(path, 78 * 2, labels, svm);
        AudioEmotionRecognizer aer = new AudioEmotionRecognizer(classifier, path, userID);

        return aer;
    case ER:
        return new AudioEmotionRecognizerV(userID);
    case IAR:
        return new InertialActivityRecognizer(userID);
    case VAR:
        return new VideoActivityRecognizer(userID);
    case LR:
        //get user loc coord / label with userID by restful service
        return new GPSLocationRecognizer(userID);
    case FR:
        return new FoodRecognizer(userID);
    }
    return null;
}