Example usage for weka.classifiers.meta FilteredClassifier toString

List of usage examples for weka.classifiers.meta FilteredClassifier toString

Introduction

In this page you can find the example usage for weka.classifiers.meta FilteredClassifier toString.

Prototype

public String toString() 

Source Link

Document

Output a representation of this classifier

Usage

From source file:com.ivanrf.smsspam.SpamClassifier.java

License:Apache License

public static void train(int wordsToKeep, String tokenizerOp, boolean useAttributeSelection,
        String classifierOp, boolean boosting, JTextArea log) {
    try {/*w  ww .  j  a  v a 2 s .c o  m*/
        long start = System.currentTimeMillis();

        String modelName = getModelName(wordsToKeep, tokenizerOp, useAttributeSelection, classifierOp,
                boosting);
        showEstimatedTime(true, modelName, log);

        Instances trainData = loadDataset("SMSSpamCollection.arff", log);
        trainData.setClassIndex(0);

        FilteredClassifier classifier = initFilterClassifier(wordsToKeep, tokenizerOp, useAttributeSelection,
                classifierOp, boosting);

        publishEstado("=== Building the classifier on the filtered data ===", log);
        classifier.buildClassifier(trainData);

        publishEstado(classifier.toString(), log);
        publishEstado("=== Training done ===", log);

        saveModel(classifier, modelName, log);

        publishEstado("Elapsed time: " + Utils.getDateHsMinSegString(System.currentTimeMillis() - start), log);
    } catch (Exception e) {
        e.printStackTrace();
        publishEstado("Error found when training", log);
    }
}