MCPcopy Create free account
hub / github.com/EdwardRaff/JSAT / testClone

Method testClone

JSAT/test/jsat/classifiers/boosting/BaggingTest.java:142–175  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

140 }
141
142 @Test
143 public void testClone()
144 {
145 System.out.println("clone");
146
147 Bagging instance = new Bagging((Classifier)new DecisionTree());
148
149 ClassificationDataSet t1 = FixedProblems.getCircles(1000, 0.1, 10.0);
150 ClassificationDataSet t2 = FixedProblems.getCircles(1000, 0.1, 10.0);
151
152 t2.applyTransform(new LinearTransform(t2));
153
154 int errors;
155
156 instance = instance.clone();
157
158 instance.trainC(t1);
159
160 Bagging result = instance.clone();
161
162 errors = 0;
163 for (int i = 0; i < t1.getSampleSize(); i++)
164 errors += Math.abs(t1.getDataPointCategory(i) - result.classify(t1.getDataPoint(i)).mostLikely());
165 assertTrue(errors < 100);
166 result.trainC(t2);
167
168 for (int i = 0; i < t1.getSampleSize(); i++)
169 errors += Math.abs(t1.getDataPointCategory(i) - instance.classify(t1.getDataPoint(i)).mostLikely());
170 assertTrue(errors < 100);
171
172 for (int i = 0; i < t2.getSampleSize(); i++)
173 errors += Math.abs(t2.getDataPointCategory(i) - result.classify(t2.getDataPoint(i)).mostLikely());
174 assertTrue(errors < 100);
175 }
176
177}

Callers

nothing calls this directly

Calls 9

getCirclesMethod · 0.95
cloneMethod · 0.95
trainCMethod · 0.95
getSampleSizeMethod · 0.95
getDataPointCategoryMethod · 0.95
classifyMethod · 0.95
getDataPointMethod · 0.95
applyTransformMethod · 0.80
mostLikelyMethod · 0.80

Tested by

no test coverage detected