(final ExecutorService execServ, final int i, final DataSet dataSet, final double nbrRange, final double nbrRangeSqrd, final Vec scratch, final double learnRate)
| 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 | { |
no test coverage detected