Repository: commons-math Updated Branches: refs/heads/MATH_3_X 1c4ebd5bd -> 044816180
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/04481618 Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/04481618 Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/04481618 Branch: refs/heads/MATH_3_X Commit: 04481618088af11b5b522fb4867569d9d6f9354d Parents: 1c4ebd5 Author: Gilles <er...@apache.org> Authored: Sun Jul 19 23:18:46 2015 +0200 Committer: Gilles <er...@apache.org> Committed: Sun Jul 19 23:18:46 2015 +0200 ---------------------------------------------------------------------- src/changes/changes.xml | 4 ++++ .../commons/math3/ml/neuralnet/sofm/KohonenUpdateAction.java | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-math/blob/04481618/src/changes/changes.xml ---------------------------------------------------------------------- diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 3e6d4be..066aa0f 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -51,6 +51,10 @@ If the output is not quite correct, check for invisible trailing spaces! </properties> <body> <release version="3.6" date="XXXX-XX-XX" description=""> + <action dev="erans" type="fix" issue="MATH-1251"> + 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"> "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/04481618/src/main/java/org/apache/commons/math3/ml/neuralnet/sofm/KohonenUpdateAction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/math3/ml/neuralnet/sofm/KohonenUpdateAction.java b/src/main/java/org/apache/commons/math3/ml/neuralnet/sofm/KohonenUpdateAction.java index e6f2305..9fa72ce 100644 --- a/src/main/java/org/apache/commons/math3/ml/neuralnet/sofm/KohonenUpdateAction.java +++ b/src/main/java/org/apache/commons/math3/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,