/** * Main method for testing this class. * * @param args the options */ public static void main(String[] args) { runClassifier(new RandomSubSpace(), args); } }
/** * Gets the current settings of the Classifier. * * @return an array of strings suitable for passing to setOptions */ public String [] getOptions() { Vector<String> result = new Vector<String>(); result.add("-P"); result.add("" + getSubSpaceSize()); Collections.addAll(result, super.getOptions()); return (String[]) result.toArray(new String[result.size()]); }
getCapabilities().testWithFail(data); int subSpaceSize = numberOfAttributes(indices.length, getSubSpaceSize()); Random random = data.getRandomNumberGenerator(m_Seed); m_Classifiers[j] = fc; Remove rm = new Remove(); rm.setOptions(new String[]{"-V", "-R", randomSubSpace(indices, subSpaceSize, classIndex + 1, random)}); fc.setFilter(rm); buildClassifiers();
/** * Main method for testing this class. * * @param args the options */ public static void main(String[] args) { runClassifier(new RandomSubSpace(), args); } }
/** * Returns a string describing classifier * * @return a description suitable for * displaying in the explorer/experimenter gui */ public String globalInfo() { return "This method constructs a decision tree based classifier that " + "maintains highest accuracy on training data and improves on " + "generalization accuracy as it grows in complexity. The classifier " + "consists of multiple trees constructed systematically by " + "pseudorandomly selecting subsets of components of the feature vector, " + "that is, trees constructed in randomly chosen subspaces.\n\n" + "For more information, see\n\n" + getTechnicalInformation().toString(); }
/** * generates an index string describing a random subspace, suitable for * the Remove filter. * * @param indices the attribute indices * @param subSpaceSize the size of the subspace * @param classIndex the class index * @param random the random number generator * @return the generated string describing the subspace */ protected String randomSubSpace(Integer[] indices, int subSpaceSize, int classIndex, Random random) { Collections.shuffle(Arrays.asList(indices), random); StringBuffer sb = new StringBuffer(""); for(int i = 0; i < subSpaceSize; i++) { sb.append(indices[i]+","); } sb.append(classIndex); if (getDebug()) System.out.println("subSPACE = " + sb); return sb.toString(); }
setSubSpaceSize(Double.parseDouble(tmpStr)); else setSubSpaceSize(0.5);
getCapabilities().testWithFail(data); int subSpaceSize = numberOfAttributes(indices.length, getSubSpaceSize()); Random random = data.getRandomNumberGenerator(m_Seed); m_Classifiers[j] = fc; Remove rm = new Remove(); rm.setOptions(new String[]{"-V", "-R", randomSubSpace(indices, subSpaceSize, classIndex + 1, random)}); fc.setFilter(rm); buildClassifiers();
/** * Main method for testing this class. * * @param args the options */ public static void main(String[] args) { runClassifier(new RandomSubSpace(), args); } }
/** * Returns a string describing classifier * * @return a description suitable for * displaying in the explorer/experimenter gui */ public String globalInfo() { return "This method constructs a decision tree based classifier that " + "maintains highest accuracy on training data and improves on " + "generalization accuracy as it grows in complexity. The classifier " + "consists of multiple trees constructed systematically by " + "pseudorandomly selecting subsets of components of the feature vector, " + "that is, trees constructed in randomly chosen subspaces.\n\n" + "For more information, see\n\n" + getTechnicalInformation().toString(); }
/** * generates an index string describing a random subspace, suitable for * the Remove filter. * * @param indices the attribute indices * @param subSpaceSize the size of the subspace * @param classIndex the class index * @param random the random number generator * @return the generated string describing the subspace */ protected String randomSubSpace(Integer[] indices, int subSpaceSize, int classIndex, Random random) { Collections.shuffle(Arrays.asList(indices), random); StringBuffer sb = new StringBuffer(""); for(int i = 0; i < subSpaceSize; i++) { sb.append(indices[i]+","); } sb.append(classIndex); if (getDebug()) System.out.println("subSPACE = " + sb); return sb.toString(); }
setSubSpaceSize(Double.parseDouble(tmpStr)); else setSubSpaceSize(0.5);
/** * Main method for testing this class. * * @param args the options */ public static void main(String[] args) { runClassifier(new RandomSubSpace(), args); } }
/** Creates a default RandomSubSpace */ public Classifier getClassifier() { return new RandomSubSpace(); }
/** * Gets the current settings of the Classifier. * * @return an array of strings suitable for passing to setOptions */ public String [] getOptions() { Vector<String> result = new Vector<String>(); result.add("-P"); result.add("" + getSubSpaceSize()); Collections.addAll(result, super.getOptions()); return (String[]) result.toArray(new String[result.size()]); }
/** Creates a default RandomSubSpace */ public Classifier getClassifier() { return new RandomSubSpace(); }