/** * Sets the maximum number of instances allowed in a leaf. * * @param num The maximum number of instances allowed in a leaf. * @throws Exception If the num is < 2, as the method cannot work for < 2 instances. */ public void setMaxInstancesInLeaf(int num) throws Exception { if (num < 2) throw new Exception( "The maximum number of instances in a leaf for " + "using MiddleOutConstructor must be >=2."); super.setMaxInstancesInLeaf(num); }
/** * Parses a given list of options. * <!-- options-start --> * Valid options are: * * <p> * * <pre> -S <num> * The seed for the random number generator used * in selecting random anchor. * (default: 1)</pre> * * <pre> -R * Use randomly chosen initial anchors.</pre> * * <!-- options-end --> * * @param options the list of options as an array of strings * @throws Exception if an option is not supported */ public void setOptions(String[] options) throws Exception { super.setOptions(options); String temp = Utils.getOption('S', options); if (temp.length() > 0) { setSeed(Integer.parseInt(temp)); } else { setSeed(1); } setInitialAnchorRandom(Utils.getFlag('R', options)); }
/** * Sets the master index array that points to instances in m_Instances, so that only this array is * manipulated, and m_Instances is left untouched. * * @param instList The master index array. */ public void setInstanceList(int[] instList) { super.setInstanceList(instList); rootRadius = -1; // this needs to be re-calculated by buildTree() }
/** * Sets the instances on which the tree is to be built. * * @param insts The instances on which to build the ball tree. */ public void setInstances(Instances insts) { super.setInstances(insts); rootRadius = -1; // this needs to be re-calculated by buildTree() }