From db6e913fc78521fc7229b35e00aa97b318cff9af Mon Sep 17 00:00:00 2001 From: Ron Wehrens Date: Thu, 12 Dec 2013 00:00:00 +0000 Subject: [PATCH] version 2.0.14 --- CHANGES | 6 ++++++ DESCRIPTION | 6 +++--- MD5 | 6 +++--- R/map.R | 7 +++++++ 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/CHANGES b/CHANGES index 24b5240..3b8602a 100644 --- a/CHANGES +++ b/CHANGES @@ -101,6 +101,12 @@ Changes in version 2.0.13: boundaries at the edges of the map are shown twice when necessary for better interpretability. +Changes in version 2.0.14: + - fixed a bug, disguised as a memory leak, where map.kohonen + attempted to calculate a distance between elements of a factor, + rather than using the membership matrix. (Spotted by CRAN checks + focusing on memory leaks, BDRipley) + *********************************************************************** diff --git a/DESCRIPTION b/DESCRIPTION index 97cee39..640d34a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,12 +1,12 @@ Package: kohonen -Version: 2.0.13 +Version: 2.0.14 Title: Supervised and unsupervised self-organising maps Author: Ron Wehrens Maintainer: Ron Wehrens Description: Supervised and unsupervised self-organising maps License: GPL (>= 2) Depends: R (>= 2.6.0), class, MASS -Packaged: 2013-12-10 13:26:38 UTC; ron +Packaged: 2013-12-12 16:42:45 UTC; ron NeedsCompilation: yes Repository: CRAN -Date/Publication: 2013-12-10 14:51:07 +Date/Publication: 2013-12-12 17:49:45 diff --git a/MD5 b/MD5 index 1b96019..afcb544 100644 --- a/MD5 +++ b/MD5 @@ -1,10 +1,10 @@ -976cae8e2ddd03dd2b52a73901c58e94 *CHANGES -bbc1455950aeb5b8698901957a42ddea *DESCRIPTION +65ff218d2542c6e926cf88fd342bc50a *CHANGES +d1f2cfdd74d5531545b51c02d8254eae *DESCRIPTION 9c45759409000a4097555af35a8ffe46 *NAMESPACE 4f8dc45b25a895e8570aa2e3d615e5ba *R/bdk.R f8872ae6c6f57e47d1b1b626e621c25f *R/check.whatmap.R 6cc0a5ca02ea151088c24bbf420ab060 *R/classvec2classmat.R -c33fb995b589bc29bff84a717e626970 *R/map.R +1ff41daac5c4303faba8642a3850c867 *R/map.R bac565cf58123910ea9529745fdf149d *R/plot.kohonen.R 6405f64156c791e44cf786767a630c63 *R/predict.kohonen.R 9685fed2072dbda758e8f60b52f47678 *R/som.R diff --git a/R/map.R b/R/map.R index 9b5e1d7..1b50488 100644 --- a/R/map.R +++ b/R/map.R @@ -21,6 +21,11 @@ ### FIXME: inefficient (but correct) if there are zeros in x$weights; ### whatmap is a more elegant way to exclude layers. +### Bug fix 12/12/13: for mapping factors, the corresponding whatmap +### layer should first be converted to a matrix, otherwise no +### meaningful distance can be calculated. Spotted by CRAN checks on +### memory leaks (BDRipley) + "map.kohonen" <- function(x, newdata, whatmap=NULL, weights, scale.distances = (nmaps > 1), ...) { @@ -48,6 +53,8 @@ for (i in seq(along = whatmap)) { np <- ncol(codes[[ whatmap[i] ]]) dt <- newdata[[ whatmap[i] ]] + if (is.factor(dt)) + dt <- classvec2classmat(dt) cd <- codes[[ whatmap[i] ]] distances[,i] <- .C("mapKohonen",