insaf021 opened a new pull request, #345:
URL: https://github.com/apache/commons-math/pull/345
On master, with the 2 by 2 VON_NEUMANN mesh used in NetworkTest:
NetworkTest.testGetNeighboursWithExcludeDoesNotModifyNetwork:136
expected:<2> but was:<1>
and after the walk that TravellingSalesmanSolver.getNeuronList does over a
6-neuron NeuronString ring:
directed links before walk = 12, after = 6
neighbours(1) = [2]
neighbours(5) = []
Network.getNeighbours(Neuron, Iterable) takes the set stored in linkMap and
calls remove() on it for each excluded neuron, so the query deletes the links
from that neuron to everything it was asked to exclude. The javadoc only says
the excluded neurons are left out of the returned list, and the Iterable
overload already collects into a fresh HashSet. KohonenUpdateAction then trains
on the damaged neighbourhoods and MapUtils.computeTopographicError measures
against them, with nothing to signal the change. It also turns a plain query
into a topology modification, which the class javadoc says is not thread-safe,
while training tasks may be reading the same sets.
The link set is now copied before the excluded identifiers are removed. The
new test fails on master as above and passes with the patch. `mvn clean verify
javadoc:javadoc -pl commons-math-neuralnet` is clean on JDK 21 (checkstyle,
SpotBugs, RAT, no new PMD findings), and the SOFM examples build and pass
against it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]