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

Method doTraining

JSAT/src/jsat/classifiers/trees/ERTrees.java:181–208  ·  view source on GitHub ↗
(ExecutorService threadPool, DataSet dataSet)

Source from the content-addressed store, hash-verified

179 }
180
181 private void doTraining(ExecutorService threadPool, DataSet dataSet) throws FailedToFitException
182 {
183 forrest = new ExtraTree[forrestSize];
184 int chunkSize = forrestSize/SystemInfo.LogicalCores;
185 int extra = forrestSize%SystemInfo.LogicalCores;
186
187 int planted = 0;
188
189 CountDownLatch latch = new CountDownLatch(SystemInfo.LogicalCores);
190 while(planted < forrestSize)
191 {
192 int start = planted;
193 int end = start+chunkSize;
194 if(extra-- > 0)
195 end++;
196 planted = end;
197 threadPool.submit(new ForrestPlanter(start, end, dataSet, latch));
198 }
199
200 try
201 {
202 latch.await();
203 }
204 catch (InterruptedException ex)
205 {
206 throw new FailedToFitException(ex);
207 }
208 }
209
210 private class ForrestPlanter implements Runnable
211 {

Callers 2

trainCMethod · 0.95
trainMethod · 0.95

Calls 2

submitMethod · 0.80
awaitMethod · 0.45

Tested by

no test coverage detected