27
27
import weka.core.Instances;
28
28
import weka.core.Option;
29
29
import weka.core.OptionHandler;
30
import weka.core.RevisionHandler;
31
import weka.core.RevisionUtils;
30
32
import weka.core.Utils;
32
34
import java.io.Serializable;
37
39
* Abstract class for constructing a BallTree .
39
41
* @author Ashraf M. Kibriya (amk14[at-the-rate]cs[dot]waikato[dot]ac[dot]nz)
40
* @version $Revision: 1.1 $
42
* @version $Revision: 1.3 $
42
44
public abstract class BallTreeConstructor
43
implements OptionHandler, Serializable {
45
implements OptionHandler, Serializable, RevisionHandler {
45
47
/** The maximum number of instances allowed in a leaf. */
46
48
protected int m_MaxInstancesInLeaf=40;
50
/** The maximum relative radius of a leaf node
51
* (relative to the smallest ball enclosing all the
52
* data (training) points). */
53
protected double m_MaxRelLeafRadius=0.001;
48
55
/** Should a parent ball completely enclose the balls
49
56
* of its two children, or only the points inside
126
133
m_MaxInstancesInLeaf = num;
137
* Returns the tip text for this property.
139
* @return tip text for this property suitable for
140
* displaying in the explorer/experimenter gui.
142
public String maxRelativeLeafRadiusTipText() {
143
return "The maximum relative radius allowed for a leaf node. " +
144
"Itis relative to the radius of the smallest ball " +
145
"enclosing all the data points (that were used to " +
146
"build the tree). This smallest ball would be the " +
147
"same as the root node's ball, if ContainChildBalls " +
148
"property is set to false (default).";
151
/** Returns the maximum relative radius of a leaf node.
152
* It is relative to the radius of the smallest ball enclosing all
153
* the data points (that were used to build the tree). This smallest
154
* ball would be the same as the root node's ball, if
155
* ContainChildBalls property is set to false (default).
156
* @return The maximum relative radius allowed for a leaf.
158
public double getMaxRelativeLeafRadius() {
159
return m_MaxRelLeafRadius;
162
/** Sets the maximum relative radius, allowed for a leaf node. The
163
* radius is relative to the radius of the smallest ball enclosing all
164
* the data points (that were used to build the tree). This smallest
165
* ball would be the same as the root node's ball, if
166
* ContainChildBalls property is set to false (default).
167
* @param radius The maximum relative radius allowed for a leaf.
168
* @throws Exception If radius is < 0.0.
170
public void setMaxRelativeLeafRadius(double radius) throws Exception {
172
throw new Exception("The radius for the leaves should be >= 0.0");
173
m_MaxRelLeafRadius = radius;
130
177
* Returns the tip text for this property.