I am trying to solve this problem:
Each image is 28 pixels in height and 28 pixels in width, for a total of 784 pixels in total. Each pixel has a single pixel-value associated with it, indicating the lightness or darkness of that pixel, with higher numbers meaning darker. This pixel-value is an integer between 0 and 255, inclusive.
The training data set, (train.csv), has 785 columns. The first column, called "label", is the digit that was drawn by the user. The rest of the columns contain the pixel-values of the associated image.
I executed the code below in R and it returned this error NA/NaN/Inf in foreign function call (arg 1)
:
#load library
library(kohonen)
#load data
train <- read.csv("C:/DigitRecognizer/data/train.csv", header=TRUE)
test <- read.csv("C:/DigitRecognizer/data/test.csv", header=TRUE)
labels <- train[,1]
train <- train[,-1]
train.scale <- scale(train)
labels.classes <- classvec2classmat(labels)
#training
system.time( training <- som(train.scale , grid=somgrid(5,5,"hexagonal"), rlen=200))
My data have many zeros and I think this is the problem.
How could I solve this issue?