# Cannot split DataSet with \<= 1 rows

**URL:** <https://community.konduit.ai/t/cannot-split-dataset-with-1-rows/1334>\
**Category:** DL4J\
**Created:** [April 22, 2021, 10:33pm UTC](https://community.konduit.ai/t/cannot-split-dataset-with-1-rows/1334 "2021-04-22T22:33:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![azanux](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/azanux/32/466_2.png) [@azanux](https://community.konduit.ai/u/azanux)\
**Post date:** [April 22, 2021, 10:33pm UTC](https://community.konduit.ai/t/cannot-split-dataset-with-1-rows/1334/1 "2021-04-22T22:33:28Z")

</div>

Hi,  
I am struggling for 2 days, when I try to read JSON file (containing 1000 lines)  
it returns me only 1 ligne when I try to use this code bellow

do i miss something , why I getting this error: Cannot split DataSet with \<= 1 rows (data set has 1 example)

why INPUT doesn’t have all lines?

even if my json file have 1000 line,

when i try to see the content of all data

```
===========INPUT===================
[[1062.3409, 1063.0620, 1066.3210, 1062.2310, 0.6198, 0.6198, 0.6198, 0, 0, 0, 0, 0, 0, 1.0000, 1.0000, 1.0000, 1.0000, 72.1000, 72.1000, 1.0000, 7.0000, 3.0000, 23.0000, 1063.0620, 1063.0620, 0, 1063.0620, 1063.0620, 0, 72.1000, 0, 0, 100.0000, 0, 0, 0, 0, 0, 0, 0, 0]]
=================OUTPUT==================
[[0, 1.0000]

JacksonLineRecordReader jacksonLineRecordReader = new JacksonLineRecordReader(getFielSelection(),new ObjectMapper(new JsonFactory()));
        Configuration configuration = new Configuration();
        configuration.set(JacksonLineRecordReader.LABELS,"OPERATORPF");
        jacksonLineRecordReader.initialize(new InputStreamInputSplit(new FileInputStream(file)));

    final DataSetIterator dataSetIterator = new RecordReaderDataSetIterator.Builder(recordReader,batchSize)
                                                                    .classification(labelIndex,numClasses)
                                                                    .build();

            //DataSetIterator dataSetIterator = new RecordReaderDataSetIterator(recordReader,batchSize,labelIndex,numClasses);

            DataSet allData = dataSetIterator.next();
            allData.shuffle();
            SplitTestAndTrain testAndTrain = allData.splitTestAndTrain(0.65); //Use 65% of data for training

```

---

<div class="post-metadata">

**Author:** ![agibsonccc](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/agibsonccc/32/697_2.png) [@agibsonccc](https://community.konduit.ai/u/agibsonccc)\
**Post date:** [April 23, 2021, 11:27am UTC](https://community.konduit.ai/t/cannot-split-dataset-with-1-rows/1334/2 "2021-04-23T11:27:43Z")

</div>

@azanux could you file an issue at [Issues · eclipse/deeplearning4j · GitHub](https://github.com/eclipse/deeplearning4j/issues) with a sample dataset I can use? Thanks!

---

<div class="post-metadata">

**Author:** ![treo](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/treo/32/47_2.png) [@treo](https://community.konduit.ai/u/treo)\
**Post date:** [May 5, 2021, 6:55am UTC](https://community.konduit.ai/t/cannot-split-dataset-with-1-rows/1334/3 "2021-05-05T06:55:59Z")

</div>

Can you please elaborate on the values of your variables? It looks very much like you have set `batchSize = 1`.

If you want to load all of your data into memory, and use `splitTestAndTrain` you need to set the batchSize to be exactly equal to your total data size.

---

<div class="post-metadata">

**Author:** ![azanux](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/azanux/32/466_2.png) [@azanux](https://community.konduit.ai/u/azanux)\
**Post date:** [May 5, 2021, 2:29pm UTC](https://community.konduit.ai/t/cannot-split-dataset-with-1-rows/1334/4 "2021-05-05T14:29:25Z")

</div>

Hi @treo  
thanks for your message, the value of batchSize was 128.  
I finally transform the JSON to CVS and work with the CSV file, the code is now working well.
