Repository: commons-math Updated Branches: refs/heads/master af199c675 -> 9c545d44a
MATH-1251 Fixed initial value of the "number of calls" counter. Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/9c545d44 Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/9c545d44 Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/9c545d44 Branch: refs/heads/master Commit: 9c545d44a4a703c88d417a6fa43298a80ee67735 Parents: af199c6 Author: Gilles <er...@apache.org> Authored: Sun Jul 19 23:26:48 2015 +0200 Committer: Gilles <er...@apache.org> Committed: Sun Jul 19 23:26:48 2015 +0200 ---------------------------------------------------------------------- src/changes/changes.xml | 4 ++++ .../commons/math4/ml/neuralnet/sofm/KohonenUpdateAction.java | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-math/blob/9c545d44/src/changes/changes.xml ---------------------------------------------------------------------- diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 2ba9b8c..01483dc 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -54,6 +54,10 @@ If the output is not quite correct, check for invisible trailing spaces! </release> <release version="4.0" date="XXXX-XX-XX" description=""> + <action dev="erans" type="fix" issue="MATH-1251"> <!-- backported to 3.6 --> + Fixed initial value of "number of calls" counter in class "KohonenUpdateAction" + (package "o.a.c.m.ml.neuralnet.sofm"). + </action> <action dev="erans" type="add" issue="MATH-1250"> <!-- backported to 3.6 --> "Neuron" class (package "o.a.c.m.ml.neuralnet"): added methods that can be used to assess concurrency performance. http://git-wip-us.apache.org/repos/asf/commons-math/blob/9c545d44/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/KohonenUpdateAction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/KohonenUpdateAction.java b/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/KohonenUpdateAction.java index b937291..1b4b54e 100644 --- a/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/KohonenUpdateAction.java +++ b/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/KohonenUpdateAction.java @@ -74,7 +74,7 @@ public class KohonenUpdateAction implements UpdateAction { /** Neighbourhood size update function. */ private final NeighbourhoodSizeFunction neighbourhoodSize; /** Number of calls to {@link #update(Network,double[])}. */ - private final AtomicLong numberOfCalls = new AtomicLong(-1); + private final AtomicLong numberOfCalls = new AtomicLong(0); /** * @param distance Distance function. @@ -95,7 +95,7 @@ public class KohonenUpdateAction implements UpdateAction { @Override public void update(Network net, double[] features) { - final long numCalls = numberOfCalls.incrementAndGet(); + final long numCalls = numberOfCalls.incrementAndGet() - 1; final double currentLearning = learningFactor.value(numCalls); final Neuron best = findAndUpdateBestNeuron(net, features,