()
| 95 | } |
| 96 | |
| 97 | @Test |
| 98 | public void testClone() |
| 99 | { |
| 100 | System.out.println("clone"); |
| 101 | |
| 102 | SAMME instance = new SAMME(new DecisionTree(10, 10, TreePruner.PruningMethod.NONE, 0.1), 50); |
| 103 | |
| 104 | ClassificationDataSet t1 = FixedProblems.getCircles(1000, 0.1, 10.0, 100.0); |
| 105 | ClassificationDataSet t2 = FixedProblems.getCircles(1000, 0.1, 10.0); |
| 106 | |
| 107 | int errors; |
| 108 | |
| 109 | instance = instance.clone(); |
| 110 | |
| 111 | instance.trainC(t1); |
| 112 | |
| 113 | SAMME result = instance.clone(); |
| 114 | |
| 115 | errors = 0; |
| 116 | for (int i = 0; i < t1.getSampleSize(); i++) |
| 117 | errors += Math.abs(t1.getDataPointCategory(i) - result.classify(t1.getDataPoint(i)).mostLikely()); |
| 118 | assertTrue(errors < 100); |
| 119 | result.trainC(t2); |
| 120 | |
| 121 | for (int i = 0; i < t1.getSampleSize(); i++) |
| 122 | errors += Math.abs(t1.getDataPointCategory(i) - instance.classify(t1.getDataPoint(i)).mostLikely()); |
| 123 | assertTrue(errors < 100); |
| 124 | |
| 125 | for (int i = 0; i < t2.getSampleSize(); i++) |
| 126 | errors += Math.abs(t2.getDataPointCategory(i) - result.classify(t2.getDataPoint(i)).mostLikely()); |
| 127 | assertTrue(errors < 100); |
| 128 | } |
| 129 | |
| 130 | } |
nothing calls this directly
no test coverage detected