1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 package de.fu_berlin.ties.classify.winnow;
23
24 import org.apache.commons.lang.builder.ToStringBuilder;
25
26 import de.fu_berlin.ties.classify.PredictionDistribution;
27
28 /***
29 * A distribution over the classes predicted by a
30 * {@link de.fu_berlin.ties.classify.winnow.Winnow Winnow classifier}.
31 * Extends the superclass by also storing the
32 * {@linkplain de.fu_berlin.ties.classify.winnow.Winnow#threshold(float)
33 * threshold} and raw threshold used by Winnow for this instance.
34 *
35 * @author Christian Siefkes
36 * @version $Revision: 1.7 $, $Date: 2004/08/23 17:08:41 $, $Author: siefkes $
37 */
38 public class WinnowDistribution extends PredictionDistribution {
39
40 /***
41 * The {@linkplain Winnow#threshold(float) threshold} used
42 * by the Winnow classifier for this instance.
43 */
44 private final float threshold;
45
46 /***
47 * The {@linkplain Winnow#rawThreshold raw threshold} used
48 * by the Winnow classifier for this instance.
49 */
50 private final float rawThreshold;
51
52 /***
53 * Creates a new instance.
54 * @param theta the {@linkplain Winnow#threshold(float) threshold}
55 * used by Winnow
56 * @param rawTheta the {@linkplain Winnow#rawThreshold raw
57 * threshold} used by Winnow
58 */
59 public WinnowDistribution(final float theta, final float rawTheta) {
60 super();
61 threshold = theta;
62 rawThreshold = rawTheta;
63 }
64
65 /***
66 * Returns the {@linkplain Winnow#rawThreshold raw threshold}
67 * used by the Winnow classifier for this instance.
68 * @return the value of the attribute
69 */
70 public float getRawThreshold() {
71 return rawThreshold;
72 }
73
74 /***
75 * Returns the {@linkplain Winnow#threshold(float) threshold}
76 * used by the Winnow classifier for this instance.
77 * @return the value of the attribute
78 */
79 public float getThreshold() {
80 return threshold;
81 }
82
83 /***
84 * Returns a string representation of this object.
85 *
86 * @return a textual representation
87 */
88 public String toString() {
89 final ToStringBuilder builder = new ToStringBuilder(this)
90 .appendSuper(super.toString())
91 .append("threshold", threshold);
92
93
94 if (rawThreshold != threshold) {
95 builder.append("raw threshold", rawThreshold);
96 }
97 return builder.toString();
98 }
99
100 }