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

Method iterationStep

JSAT/src/jsat/classifiers/neuralnetwork/SOM.java:258–293  ·  view source on GitHub ↗
(final ExecutorService execServ, final int i, final DataSet dataSet, final double nbrRange, final double nbrRangeSqrd, final Vec scratch, final double learnRate)

Source from the content-addressed store, hash-verified

256 }
257
258 private void iterationStep(final ExecutorService execServ, final int i, final DataSet dataSet, final double nbrRange, final double nbrRangeSqrd, final Vec scratch, final double learnRate)
259 {
260 Vec input_i = dataSet.getDataPoint(i).getNumericalValues();
261 PairedReturn<Integer, Integer> closestBMUPR = getBMU(input_i);
262 int xBest = closestBMUPR.getFirstItem();
263 int yBest = closestBMUPR.getSecondItem();
264
265 //The bounding square of values that need to be updated
266
267 int xStart = Math.max((int)(xBest - nbrRange)-1, 0);
268 int yStart = Math.max((int)(yBest - nbrRange)-1, 0);
269 int xEnd = Math.min((int)(xBest + nbrRange)+1, somWidth);
270 int yEnd = Math.min((int)(yBest + nbrRange)+1, somHeight);
271
272 for(int x = xStart; x < xEnd; x++)
273 {
274 Vec[] weights_x = weights[x];
275 for(int y = yStart; y < yEnd; y++)
276 {
277 int xLength = xBest - x;
278 int yLength = yBest - y;
279 int pointDistSqrd = xLength*xLength + yLength*yLength;
280
281 if(pointDistSqrd < nbrRangeSqrd)//point is in the circle range,
282 {
283 double distWeight = kf.k(sqrt(pointDistSqrd)/nbrRange);
284 Vec weights_xy = weights_x[y];
285 if(execServ == null)
286 updateWeight(input_i, scratch, weights_xy, distWeight*learnRate);
287 else
288 weightUpdates.get(x).get(y).add(dataSet.getDataPoint(i));
289 }
290 }
291
292 }
293 }
294
295 private List<VecPaired<Vec, Integer>> setUpVectorCollection(ExecutorService threadPool)
296 {

Callers 2

trainSOMMethod · 0.95
runMethod · 0.95

Calls 11

getBMUMethod · 0.95
updateWeightMethod · 0.95
getNumericalValuesMethod · 0.80
kMethod · 0.65
getDataPointMethod · 0.45
getFirstItemMethod · 0.45
getSecondItemMethod · 0.45
maxMethod · 0.45
minMethod · 0.45
addMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected