Wagging is a meta-classifier that is related to Bagging. Instead training on re-sampled data sets, it trains on randomly re-weighted data sets. The weight of each point is selected at random from a specified distribution, and set to zero if negative. See: <a href="http://www.springe
| 36 | * @author Edward Raff |
| 37 | */ |
| 38 | public class Wagging implements Classifier, Regressor, Parameterized |
| 39 | { |
| 40 | |
| 41 | private static final long serialVersionUID = 4999034730848794619L; |
| 42 | private ContinuousDistribution dist; |
| 43 | private int iterations; |
| 44 | private Classifier weakL; |
| 45 | private Regressor weakR; |
| 46 | |
| 47 | private CategoricalData predicting; |
| 48 | |
| 49 | private Classifier[] hypotsL; |
| 50 | private Regressor[] hypotsR; |
| 51 | |
| 52 | /** |
| 53 | * Creates a new Wagging classifier |
| 54 | * @param dist the distribution to select weights from |
| 55 | * @param weakL the weak learner to use |
| 56 | * @param iterations the number of iterations to perform |
| 57 | */ |
| 58 | public Wagging(ContinuousDistribution dist, Classifier weakL, int iterations) |
| 59 | { |
| 60 | setDistribution(dist); |
| 61 | setIterations(iterations); |
| 62 | setWeakLearner(weakL); |
| 63 | } |
| 64 | |
| 65 | /** |
| 66 | * Creates a new Wagging regressor |
| 67 | * @param dist the distribution to select weights from |
| 68 | * @param weakR the weak learner to use |
| 69 | * @param iterations the number of iterations to perform |
| 70 | */ |
| 71 | public Wagging(ContinuousDistribution dist, Regressor weakR, int iterations) |
| 72 | { |
| 73 | setDistribution(dist); |
| 74 | setIterations(iterations); |
| 75 | setWeakLearner(weakR); |
| 76 | } |
| 77 | |
| 78 | /** |
| 79 | * Copy constructor |
| 80 | * @param clone the one to clone |
| 81 | */ |
| 82 | protected Wagging(Wagging clone) |
| 83 | { |
| 84 | this.dist = clone.dist.clone(); |
| 85 | this.iterations = clone.iterations; |
| 86 | if(clone.weakL != null) |
| 87 | setWeakLearner(clone.weakL.clone()); |
| 88 | if(clone.weakR != null) |
| 89 | setWeakLearner(clone.weakR.clone()); |
| 90 | if(clone.predicting != null) |
| 91 | this.predicting = clone.predicting.clone(); |
| 92 | |
| 93 | if(clone.hypotsL != null) |
| 94 | { |
| 95 | hypotsL = new Classifier[clone.hypotsL.length]; |
nothing calls this directly
no outgoing calls
no test coverage detected