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

Method testClone

JSAT/test/jsat/classifiers/boosting/SAMMETest.java:97–128  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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}

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected