Example usage for weka.classifiers.functions SMO main

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

Introduction

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

Prototype

public static void main(String[] argv) 

Source Link

Document

Main method for testing this class.

Usage

From source file:classifier.page.CreateWekaInput.java

License:Open Source License

public static void main(String[] args) {
    StopList st = null;//from w ww .j a v  a2  s.  co  m
    try {
        String cfgDir = args[0];
        String stoplistFile = cfgDir + "/stoplist.txt";
        st = new classifier.util.string.StopListArquivo(stoplistFile);
        String trainingPath = args[1];
        File dir = new File(trainingPath);
        File dirTest = null;
        CreateWekaInput createwekainput = new CreateWekaInput(dir, dirTest, st);
        String outputPath = args[2];
        createwekainput.centroid2Weka(trainingPath + "/weka.arff");

        SMO.main(new String[] { "-M", "-d", outputPath + "/pageclassifier.model", "-t",
                trainingPath + "/weka.arff" });
    } catch (MalformedURLException ex1) {
        ex1.printStackTrace();
    } catch (IOException ex1) {
        ex1.printStackTrace();
    } catch (SAXException ex1) {
        ex1.printStackTrace();
    }
}

From source file:focusedCrawler.target.classifier.WekaTargetClassifierBuilder.java

License:Open Source License

public static void trainModel(String trainingPath, String outputPath, String learner) {
    if (learner == null) {
        learner = "SMO";
    }//w  w w  .  ja  v  a 2 s .  c  o  m

    System.out.println("Training " + learner + " model...");
    if (learner.equals("SMO")) {
        SMO.main(new String[] { "-M", "-d", outputPath + "/pageclassifier.model", "-t",
                trainingPath + "/weka.arff", "-C", "0.01" });
    } else if (learner.equals("RandomForest")) {
        RandomForest.main(new String[] {
                //              "-K", "5", // k-fold cross validation
                "-I", "100", // Number of trees to build
                "-d", outputPath + "/pageclassifier.model", "-t", trainingPath + "/weka.arff" });
    } else {
        System.out.println("Unknow learner: " + learner);
        return;
    }
}