/** * Parses a given list of options. <p/> * <!-- options-start --> * Valid options are: <p/> * * <pre> -S <classname and options> * Node splitting method to use. * (default: weka.core.neighboursearch.kdtrees.SlidingMidPointOfWidestSide)</pre> * * <pre> -W <value> * Set minimal width of a box * (default: 1.0E-2).</pre> * * <pre> -L * Maximal number of instances in a leaf * (default: 40).</pre> * * <pre> -N * Normalizing will be done * (Select dimension for split, with normalising to universe).</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 optionString = Utils.getOption('S', options); if (optionString.length() != 0) { String splitMethodSpec[] = Utils.splitOptions(optionString); if (splitMethodSpec.length == 0) { throw new Exception("Invalid DistanceFunction specification string."); } String className = splitMethodSpec[0]; splitMethodSpec[0] = ""; setNodeSplitter((KDTreeNodeSplitter) Utils.forName( KDTreeNodeSplitter.class, className, splitMethodSpec)); } else { setNodeSplitter(new SlidingMidPointOfWidestSide()); } optionString = Utils.getOption('W', options); if (optionString.length() != 0) setMinBoxRelWidth(Double.parseDouble(optionString)); else setMinBoxRelWidth(1.0E-2); optionString = Utils.getOption('L', options); if (optionString.length() != 0) setMaxInstInLeaf(Integer.parseInt(optionString)); else setMaxInstInLeaf(40); setNormalizeNodeWidth(Utils.getFlag('N', options)); Utils.checkForRemainingOptions(options); }
/** * Parses a given list of options. <p/> * <!-- options-start --> * Valid options are: <p/> * * <pre> -S <classname and options> * Node splitting method to use. * (default: weka.core.neighboursearch.kdtrees.SlidingMidPointOfWidestSide)</pre> * * <pre> -W <value> * Set minimal width of a box * (default: 1.0E-2).</pre> * * <pre> -L * Maximal number of instances in a leaf * (default: 40).</pre> * * <pre> -N * Normalizing will be done * (Select dimension for split, with normalising to universe).</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 optionString = Utils.getOption('S', options); if (optionString.length() != 0) { String splitMethodSpec[] = Utils.splitOptions(optionString); if (splitMethodSpec.length == 0) { throw new Exception("Invalid DistanceFunction specification string."); } String className = splitMethodSpec[0]; splitMethodSpec[0] = ""; setNodeSplitter((KDTreeNodeSplitter) Utils.forName( KDTreeNodeSplitter.class, className, splitMethodSpec)); } else { setNodeSplitter(new SlidingMidPointOfWidestSide()); } optionString = Utils.getOption('W', options); if (optionString.length() != 0) setMinBoxRelWidth(Double.parseDouble(optionString)); else setMinBoxRelWidth(1.0E-2); optionString = Utils.getOption('L', options); if (optionString.length() != 0) setMaxInstInLeaf(Integer.parseInt(optionString)); else setMaxInstInLeaf(40); setNormalizeNodeWidth(Utils.getFlag('N', options)); }
/** * Returns the splitting method currently in use to split the nodes of the * KDTree. * * @return The KDTreeNodeSplitter currently in use. */ public KDTreeNodeSplitter getNodeSplitter() { return m_Splitter; }
/** * Sets the splitting method to use to split the nodes of the KDTree. * * @param splitter The KDTreeNodeSplitter to use. */ public void setNodeSplitter(KDTreeNodeSplitter splitter) { m_Splitter = splitter; }