Last active
May 15, 2018 16:44
-
-
Save holgerbrandl/108cf2aa3fc7c1c0786bd75ecf387c7b to your computer and use it in GitHub Desktop.
example to illustrate issue with RecordReaderDataSetIterator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package org.deeplearning4j.datasets.datavec | |
| import org.datavec.api.records.reader.impl.csv.CSVRecordReader | |
| import org.datavec.api.split.FileSplit | |
| import org.nd4j.linalg.io.ClassPathResource | |
| fun main(args: Array<String>) { | |
| val recordReader = CSVRecordReader(0, ',').apply{ | |
| // initialize(FileSplit(File("/Users/brandl/projects/deep_learning/dl4j/dl4j-test-resources/target/classes/iris.txt"))) | |
| initialize(FileSplit(ClassPathResource("iris.txt").tempFileFromArchive)) | |
| } | |
| val iter = RecordReaderDataSetIterator.Builder(recordReader, 15) | |
| .classification(4, 3).build() | |
| val next = iter.next() | |
| println(next.features.shapeInfoToString()) | |
| println(next.labels.slice(0).toFloatVector().joinToString(",")) | |
| println(next.features.slice(0).toFloatVector().joinToString(",")) | |
| println("first record is ${recordReader.apply{reset()}.next()}") | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment