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

Method testClone

JSAT/test/jsat/classifiers/trees/ERTreesTest.java:170–203  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

168
169
170 @Test
171 public void testClone()
172 {
173 System.out.println("clone");
174 for(int k = 0; k < 3; k++)
175 {
176 boolean useCatFeatures = k < 2;
177 ERTrees instance = new ERTrees();
178 instance.setBinaryCategoricalSplitting(k == 1);
179
180 ClassificationDataSet t1 = FixedProblems.getSimpleKClassLinear(1000, 3, RandomUtil.getRandom());
181 ClassificationDataSet t2 = FixedProblems.getSimpleKClassLinear(1000, 6, RandomUtil.getRandom());
182 if(useCatFeatures)
183 {
184 t1.applyTransform(new NumericalToHistogram(t1));
185 t2.applyTransform(new NumericalToHistogram(t2));
186 }
187
188 instance = instance.clone();
189
190 instance.trainC(t1);
191
192 ERTrees result = instance.clone();
193 for(int i = 0; i < t1.getSampleSize(); i++)
194 assertEquals(t1.getDataPointCategory(i), result.classify(t1.getDataPoint(i)).mostLikely());
195 result.trainC(t2);
196
197 for(int i = 0; i < t1.getSampleSize(); i++)
198 assertEquals(t1.getDataPointCategory(i), instance.classify(t1.getDataPoint(i)).mostLikely());
199
200 for(int i = 0; i < t2.getSampleSize(); i++)
201 assertEquals(t2.getDataPointCategory(i), result.classify(t2.getDataPoint(i)).mostLikely());
202 }
203 }
204
205}

Callers

nothing calls this directly

Calls 11

getSimpleKClassLinearMethod · 0.95
getRandomMethod · 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