~ubuntu-branches/ubuntu/oneiric/weka/oneiric

« back to all changes in this revision

Viewing changes to weka/core/neighboursearch/balltrees/BallTreeConstructor.java

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner, Soeren Sonnenburg, Torsten Werner
  • Date: 2008-08-10 21:27:05 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080810212705-tr8etpnkdx2ziktp
Tags: 3.5.8-1
[ Soeren Sonnenburg ]
* Bump Standards Version to 3.8.0.
* Remove references to non-free Java in debian/copyright.

[ Torsten Werner ]
* new upstream release
* Switch to openjdk-6.
* Move package to main.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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;
31
33
 
32
34
import java.io.Serializable;
37
39
 * Abstract class for constructing a BallTree .
38
40
 * 
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 $
41
43
 */
42
44
public abstract class BallTreeConstructor 
43
 
  implements OptionHandler, Serializable {
 
45
  implements OptionHandler, Serializable, RevisionHandler {
44
46
  
45
47
  /** The maximum number of instances allowed in a leaf. */
46
48
  protected int m_MaxInstancesInLeaf=40;
47
49
  
 
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;
 
54
  
48
55
  /** Should a parent ball completely enclose the balls
49
56
   * of its two children, or only the points inside
50
57
   * its children. */
125
132
                          "be >=1.");
126
133
    m_MaxInstancesInLeaf = num;
127
134
  }
128
 
  
 
135
 
 
136
  /**
 
137
   * Returns the tip text for this property.
 
138
   * 
 
139
   * @return tip text for this property suitable for
 
140
   * displaying in the explorer/experimenter gui.
 
141
   */
 
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).";
 
149
  }
 
150
 
 
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.
 
157
   */
 
158
  public double getMaxRelativeLeafRadius() {
 
159
    return m_MaxRelLeafRadius;
 
160
  }
 
161
 
 
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.
 
169
   */
 
170
  public void setMaxRelativeLeafRadius(double radius) throws Exception {
 
171
        if(radius < 0.0)
 
172
          throw new Exception("The radius for the leaves should be >= 0.0");
 
173
        m_MaxRelLeafRadius = radius;
 
174
  }
 
175
 
129
176
  /**
130
177
   * Returns the tip text for this property.
131
178
   * 
270
317
    
271
318
    return result.toArray(new String[result.size()]);
272
319
  }
 
320
  
 
321
  /**
 
322
   * Returns the revision string.
 
323
   * 
 
324
   * @return            the revision
 
325
   */
 
326
  public String getRevision() {
 
327
    return RevisionUtils.extract("$Revision: 1.3 $");
 
328
  }
273
329
}