Example usage for weka.classifiers.rules Prism Prism

List of usage examples for weka.classifiers.rules Prism Prism

Introduction

In this page you can find the example usage for weka.classifiers.rules Prism Prism.

Prototype

Prism

Source Link

Usage

From source file:prismcrossvalidation.Classifier.java

static public String crossValidationPRISM_DISCRET() throws FileNotFoundException, IOException, Exception {
    String prismResult = "";
    String source = MainWindow.pathChooseField.getText();
    Instances data = DataLoad.loadData(source.replace("\\", "/"));

    data.setClassIndex(data.numAttributes() - 1);

    Discretize filter = new Discretize();
    Prism rules = new Prism();

    FilteredClassifier fClassifier = new FilteredClassifier();
    fClassifier.setFilter(filter); //Ustawienie aktualnego filtra
    fClassifier.setClassifier(rules); //Ustawienie aktualnego klasyfikatora

    Evaluation eval = new MyEvaluation(data);
    eval.crossValidateModel(fClassifier, data, fold, new Random(1)); //CV dla 10 foldow

    System.out.println("amount of folds: " + fold);
    MainWindow.logArea.append("Amount of folds: " + fold);

    System.out.println(eval.toSummaryString("Wyniki:", false));
    MainWindow.logArea.append(eval.toSummaryString("Wyniki:", false));

    return prismResult = eval.toSummaryString("Wyniki:", false);
}