Hi!
I’m currently applying the approach documented in Quickstart with Deeplearning4J to the Iris basic case.
I have correctly included in the pom.xml the required entries. The program compiles well but generates the following exception:
Exception in thread “main” java.util.NoSuchElementException: No more elements found!
It seems like there was a problem with the data, but I use exactly the iris.txt file of DL4J examples with 4 doubles and the class (0,1 or 2):
5.1,3.5,1.4,0.2,0
…
5.9,3.0,5.1,1.8,2
The code is as follows:
Random random = new Random();
random.setSeed(0xC0FFEE);
FileSplit inputSplit = new FileSplit(new File("C:\\Users\\username\\dl4j-examples-data\\datavec-examples\\IrisData"), random);
RecordReader recordReader = new CSVRecordReader();
recordReader.initialize(inputSplit);
//sepal length in cm
//sepal width in cm
//petal length in cm
//petal width in cm
//0 is Iris Setosa
//1 is Iris Versicolour
//2 is Iris Virginica
Schema schema = new Schema.Builder()
.addColumnsDouble("sepal length", "sepal width", "petal length", "petal width")
.addColumnCategorical("Class", "0", "1", "2")
.build();
DataAnalysis analysis = AnalyzeLocal.analyze(schema, recordReader); // <===== GENERATES AN EXCEPTION
The exception is raised by the last line of code.
The rest of the code (not shown) to build the network, train, test and save the model runs fine if the code line above is set as a comment.
The detail error stack is:
Exception in thread "main" java.util.NoSuchElementException: No more elements found!
at org.datavec.api.records.reader.impl.LineRecordReader.next(LineRecordReader.java:117)
at org.datavec.api.records.reader.impl.csv.CSVRecordReader.readStringLine(CSVRecordReader.java:193)
at org.datavec.api.records.reader.impl.csv.CSVRecordReader.next(CSVRecordReader.java:173)
at org.datavec.api.records.reader.impl.csv.CSVRecordReader.nextRecord(CSVRecordReader.java:199)
at org.deeplearning4j.datasets.datavec.RecordReaderDataSetIterator.initializeUnderlying(RecordReaderDataSetIterator.java:194)
at org.deeplearning4j.datasets.datavec.RecordReaderDataSetIterator.next(RecordReaderDataSetIterator.java:341)
at org.deeplearning4j.datasets.datavec.RecordReaderDataSetIterator.next(RecordReaderDataSetIterator.java:421)
at org.deeplearning4j.datasets.datavec.RecordReaderDataSetIterator.next(RecordReaderDataSetIterator.java:53)
at com.thenlpcy.mydl4jwebservernb.MyDL4JWebServerNB.main(MyDL4JWebServerNB.java:100)
Command execution failed.
org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
at org.apache.commons.exec.DefaultExecutor.executeInternal (DefaultExecutor.java:404)
at org.apache.commons.exec.DefaultExecutor.execute (DefaultExecutor.java:166)
at org.codehaus.mojo.exec.ExecMojo.executeCommandLine (ExecMojo.java:1000)
at org.codehaus.mojo.exec.ExecMojo.executeCommandLine (ExecMojo.java:947)
at org.codehaus.mojo.exec.ExecMojo.execute (ExecMojo.java:471)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:342)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:330)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:175)
at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:76)
at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:163)
at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:160)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:827)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:272)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:195)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:568)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Does anyone knows what may go wrong here?