Example usage for weka.classifiers.trees RandomTree setNumFolds

List of usage examples for weka.classifiers.trees RandomTree setNumFolds

Introduction

In this page you can find the example usage for weka.classifiers.trees RandomTree setNumFolds.

Prototype

public void setNumFolds(int newNumFolds) 

Source Link

Document

Set the value of NumFolds.

Usage

From source file:controller.MineroControler.java

public String clasificardorArbolAleat(String atributo) {
    BufferedReader breader = null;
    Instances datos = null;//  w ww .  j av  a 2  s  .c o  m
    breader = new BufferedReader(fuente_arff);
    try {
        datos = new Instances(breader);
        Attribute atr = datos.attribute(atributo);
        datos.setClass(atr);
        //datos.setClassIndex(0);
    } catch (IOException ex) {
        System.err.println("Problemas al intentar cargar los datos");
        return null;
    }

    RandomTree arbol = new RandomTree(); // Class for constructing a tree that considers K randomly chosen attributes at each node. 

    try {

        arbol.setNumFolds(100);
        arbol.setKValue(0);
        arbol.setMinNum(1);
        arbol.setMaxDepth(0);
        arbol.setSeed(1);
        arbol.buildClassifier(datos);

    } catch (Exception ex) {
        System.err.println("Problemas al ejecutar algorimo de clasificacion" + ex.getLocalizedMessage());
    }
    return arbol.toString();
}