From bc8080331e2ba237844f0f203e7f612686d17638 Mon Sep 17 00:00:00 2001 From: David Silva Date: Sun, 7 Feb 2021 00:37:14 +0000 Subject: [PATCH] Call find_bmu method after last training iteration This issue was affecting some visualizations such as BmuHitsView, which was calling som._bmu[0] to get the number of observations allocated to each unit as their BMU. Tests were made which compared the new output of BmuHitsView with som.project_data() output. They matched as expected. Fixes sevamoo/SOMPY#83 --- sompy/sompy.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sompy/sompy.py b/sompy/sompy.py index bc9d779..61f460b 100644 --- a/sompy/sompy.py +++ b/sompy/sompy.py @@ -352,7 +352,8 @@ def _batchtrain(self, trainlen, radiusin, radiusfin, njob=1, logging.info("nan quantization error, exit train\n") #sys.exit("quantization error=nan, exit train") - + + bmu = self.find_bmu(data, njb=njob) bmu[1] = np.sqrt(bmu[1] + fixed_euclidean_x2) self._bmu = bmu