-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Differing results between R and CLI #26
Comments
The kernelType is different? Have you tried both use kernelType=0? |
The starting learning rate is also different. |
Copied wrong CLI command. They were both done with l =1. (BTW, I was doing parameter optimization and found that, using gaussian, the starting learning rate has little effect on quant error which I had seen previously.) The CLI run was gpu so kernal is 1. I had previously ran cpu on CLI with kernel = 0 and got identical results to the corresponding gpu run. |
Actually, if it is compiled without CUDA support, the GPU kernel (=1) falls back to the CPU kernel without saying a word. In any case, the problem is odd. To comply with CRAN, the random number generator of the R version is the one from
which should be identical in effect to the
|
The CLI version was compiled with CUDA support. Randomization also should not matter as I am using an initial codebook. The data is not nomalized and is identical in both cases. I have not made any changes to OMP_NUM_THREADS. I evaluate quant error by averaging the euclidean distance between each input vector and its BMU using the rdist function in the fields package in R: weights <- res$codebook MinM <- mean(result) |
For me the above commit gives me the codebook more similar with the CLI version than before. So it might be related to the wrong handling of column-major matrix when converting array between C and R. Please try if this fixes the issue. |
I deleted my previous comment with the images. Although they are accurate, I decided I am not ready to have my work in a public forum yet. I hope that is OK. |
I'll give that commit a try and let you know. Does that commit include the neighborhood function parameter? |
That includes the neighborhood function parameter |
Tryed #26. Gaussian gave quant error of 5.78. Very much in line with CLI. Bubble gave improved quant error of 5.34. With Matlab and kohonen R package I was getting < 5. I may need to optimize parameters. Thanks |
The R interface is a bit of a mistreated foster child, as we are inexperienced with it. Thanks for pointing out this bug. |
The fix is on CRAN now. |
Thanks very much. I did some overdue clean up and tagged version 1.5.1. The update is released on MLOSS and GitHub. Please update PyPI. |
OK. Just uploaded source to PyPI, will build the binaries later. |
I had been using the CLI version of Somoclu and getting results consistent with other implementations of batch-trained SOMs (R-Kohonen and Matlab Neural network Toolbox). When you responded to my request for the inclusion of a bubble neighborhood function I decided to use the R package to test it rather than recompile for CLI (which was initially done for me by a colleague.) Following your instructions I compiled and tested the new version of the R package. I found that I was getting much higher quantitization errors than in CLI. In order to determine whether the difference was due to R or the requested changes I installed the current, unmodified, R package and compared the same input file using the same initial codebook. Using CLI I got a quantitization error of 5.73 but with R the quantitization error was 18.95.
Here is the CLI command:
somoclu -c T7_init_weights_nospace_CRend.wts -e 100 -k 1 -m planar -t linear -r 9 -R 1 -T linear -l 1 -L 0.01 -s 0 -x 18 -y 15 t7_norow_somoclu T_Opt_6
Here is the R script:
dataTemp <- data.frame(fread("t7_norow_somoclu"))
dataSource <- as.matrix(dataTemp)
initTemp <- data.frame(fread("T7_init_weights_nospace_CRend.wts"))
initSource <- as.matrix(initTemp)
nSomX <- 18
nSomY <- 15
nEpoch <- 100
radius0 <- 9
radiusN <- 1
radiusCooling <- "linear"
scale0 <- 1
scaleN <- 0.01
scaleCooling <- "linear"
kernelType <- 0
mapType <- "planar"
gridType <- "rectangular"
compactSupport <- FALSE
codebook <- initSource
res <- Rsomoclu.train(dataSource, nEpoch, nSomX, nSomY, radius0, radiusN, radiusCooling, scale0, scaleN, scaleCooling, kernelType, mapType, gridType, compactSupport, codebook)
head(res$globalBmus)
The text was updated successfully, but these errors were encountered: