/** * Enumerates all the attributes. * * @return An enumeration that contains all the attributes. */ public Enumeration enumerateAttributes() { Vector help = new Vector(attributes.size() - 1); for (int i = 0; i < attributes.size(); i++) if (i != classIndex) help.addElement(attributes.elementAt(i)); return help.elements(); }
/** Creates the total selector's set for get all the possible rules */ private Complejo hazSelectores(Dataset train) { Complejo almacenSelectores; int nClases = train.getnclases(); almacenSelectores = new Complejo(nClases); // Aqui voy a almacenar los selectores (numVariable,operador,valor) Attribute[] atributos = null; int num_atributos, type; Vector nominalValues; atributos = Attributes.getAttributes(); num_atributos = Attributes.getNumAttributes(); Selector s; for (int i = 0; i < train.getnentradas(); i++) { type = atributos[i].getType(); switch (type) { case 0: // NOMINAL nominalValues = atributos[i].getNominalValuesList(); // System.out.print("{"); for (int j = 0; j < nominalValues.size(); j++) { // System.out.print ((String)nominalValues.elementAt(j)+" "); s = new Selector(i, 0, (String) nominalValues.elementAt(j), true); // [atr,op,valor] // incluimos tb los valores en double para facilitar algunas funciones s.setValor((double) j); almacenSelectores.addSelector(s); // s.print(); } // System.out.println("}"); break; } // System.out.println(num_atributos); } return almacenSelectores; }
/** * Returns the attribute that has the name. * * @param name The name of the attribute. */ public final Attribute getAttribute(String name) { for (int i = 0; i < attributes.size(); i++) if (((Attribute) attributes.elementAt(i)).name().equalsIgnoreCase(name)) return (Attribute) attributes.elementAt(i); return null; }
/** * Checks if a node is legitimate. A node is illegitimate if its hamming distance to a pruned node * is 1 (this is, the node is a child of a previously pruned node). * * @param f node to check its legitimacy * @return true if the node is legitimate, false otherwise. */ private boolean legitimate(boolean f[]) { boolean feas = true; for (int i = 0; i < pruned.size() && feas; i++) { if (hamming(pruned.elementAt(i), f) == 1) feas = false; } return feas; }
/** Returns the number of itemsets. */ public final int numItemsets() { return itemsets.size(); }
/** Returns the number of attributes. */ public final int numAttributes() { return attributes.size(); }