@@ -0,0 +1,1164 @@
+package be.iminds.iot.dianne.nn.learn.processors;%0A%0Aimport java.util.HashMap;%0Aimport java.util.Map;%0Aimport java.util.UUID;%0A%0Aimport be.iminds.iot.dianne.api.nn.learn.Processor;%0Aimport be.iminds.iot.dianne.tensor.Tensor;%0A%0A/**%0A * Additional learning techniques like Momentum can be implemented as a Processor decorator%0A */%0Apublic class RegularizationProcessor extends AbstractProcessor %7B%0A%0A%09private final Processor decorated;%0A%09private final float regularization;%0A%09%0A%09private Map%3CUUID, Tensor%3E previousDelta = new HashMap%3CUUID, Tensor%3E();%0A%09%0A%09public RegularizationProcessor( AbstractProcessor p,%0A%09%09%09Map%3CString, String%3E config) %7B%0A%09%09super(p.factory, p.input, p.output, p.toTrain, p.dataset);%0A%09%09decorated = p;%0A%09%09%0A%09%09// TODO set regularization based on config%0A%09%09regularization = 0.001f;%0A%09%7D%0A%09%0A%09@Override%0A%09public float processNext() %7B%0A%09%09float error = decorated.processNext();%0A%09%09%0A%09%09// subtract previous parameters%0A%09%09toTrain.entrySet().stream().forEach(e -%3E %7B%0A%09%09%09Tensor params = e.getValue().getParameters();%0A%09%09%09Tensor deltaParams = e.getValue().getDeltaParameters();%0A%09%09%09factory.getTensorMath().sub(deltaParams, deltaParams, regularization, params);%0A%09%09%7D);%0A%09%09%0A%09%09return error;%0A%09%7D%0A%0A%7D%0A

add RegularizationProcessor