Mxnet CSVIter use label shape not work as expected


#1

I load training data from CSV ,I find the shape of label confusing me .

I give both param shape (1,4),the shape of data is 10x1x4.but the label is 10.

my CSV-file is like this:
train
11,42,2,1480592520
11,47,2,1480592820
12,4,2,1480593840
12,12,2,1480594320
12,15,2,1480594500
12,18,2,1480594680
12,30,2,1480595400
12,34,2,1480595640
12,48,2,1480596480
12,51,2,1480596660

label

0.0,0.0,1.0,0.0
0.0,0.0,1.0,0.0
0.0,1.0,0.0,0.0
0.0,1.0,0.0,0.0
0.0,0.0,1.0,0.0
0.0,1.0,0.0,0.0
0.0,0.0,1.0,0.0
0.0,0.0,1.0,0.0
0.0,1.0,0.0,0.0
0.0,1.0,0.0,0.0
0.0,1.0,0.0,0.0
0.0,1.0,0.0,0.0
0.0,1.0,0.0,0.0
0.0,0.0,1.0,0.0
0.0,1.0,0.0,0.0


#2

Hi @niceduan,

You should remove the first dimension of your data and label shape; i.e. data_shape=(4), and label_shape=(4). You need to provide the shape for a single sample, so for a CSV file with each sample on its own row the shape will be just the number of columns.

I notice that you’ve got a different number of rows in label.csv and train.csv. I wouldn’t expect this, as you want every data sample to have a corresponding label. Is this just a copy/paste error?