1

I want to read a simple CSV file with just a list of numbers using Datavec, for use within Deeplearning4j. I've tried numerous examples but keep getting errors. e.g. when I execute this:

    RecordReader rrTest = new CSVRecordReader();
    rrTest.initialize(new FileSplit(new File(INPUT_FILE)));
    DataSetIterator testIter = new RecordReaderDataSetIterator(rrTest, 150, 0, 1);

I get this error:

Exception in thread "main" org.nd4j.linalg.exception.ND4JIllegalStateException: Invalid shape: Requested INDArray shape [144, 0] contains dimension size values < 1 (all dimensions must be 1 or more).

Changing the 'labelIndex' from 0 to 1 gives the same error.

The data in the file looks like this:

112
118
132
129
121
135
148
148
136
119
104
118
115

How do I read this file? I guess the result should be a DataSet, as input for a dl4j.

1 Answer 1

0

You have no labels. You need at least 2 values. The RecordReaderDataSetIterator usually expects there to be a label there somewhere. You haven't defined anything to learn. I'm not sure how new you are to machine learning, but I would step back and learn the basics first.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.