I am study Quickstart with Deeplearning4J. This is classfier example, but I change to linear regression. My target is to predict a number, may be this number not in my dataset lables.
By the example,
RecordReaderDataSetIterator trainIterator = new RecordReaderDataSetIterator.Builder(trainRecordReader, batchSize)
.classification(finalSchema.getIndexOfColumn(“Exited”), 2)
.build();
I change to
RecordReaderDataSetIterator trainIterator = new RecordReaderDataSetIterator.Builder(trainRecordReader, batchSize).regression(finalSchema.getIndexOfColumn(“LABEL_STD”))
.build();
and
MultiLayerConfiguration config = new NeuralNetConfiguration.Builder()
.seed(0xC0FFEE)
.weightInit(WeightInit.XAVIER)
.activation(Activation.TANH)
.updater(new Adam.Builder().learningRate(0.001).build())
.l2(0.000316)
.list(
new DenseLayer.Builder().nOut(finalSchema.numColumns() - 1).build(),
new DenseLayer.Builder().nOut(finalSchema.numColumns() - 1).build(),
new DenseLayer.Builder().nOut(finalSchema.numColumns() - 1).build(),
new DenseLayer.Builder().nOut(finalSchema.numColumns() - 1).build(),
new DenseLayer.Builder().nOut(finalSchema.numColumns() - 1).build(),
new RnnOutputLayer.Builder(LossFunctions.LossFunction.MSE).nOut(1).activation(Activation.IDENTITY).build())
.setInputType(InputType.feedForward(finalSchema.numColumns() - 1))
.build();
but i got the following error
[vert.x-eventloop-thread-0] INFO org.deeplearning4j.ui.VertxUIServer - Deeplearning4j UI server started at: http://localhost:9000
[main] INFO org.deeplearning4j.ui.VertxUIServer - StatsStorage instance attached to UI: InMemoryStatsStorage(uid=206f2af3)
Exception in thread “main” java.lang.IllegalStateException: Expected rank 3 labels array, got label array with shape [80, 1]
at org.nd4j.common.base.Preconditions.throwStateEx(Preconditions.java:639)
at org.nd4j.common.base.Preconditions.checkState(Preconditions.java:301)
at org.deeplearning4j.nn.layers.recurrent.RnnOutputLayer.backpropGradient(RnnOutputLayer.java:58)
at org.deeplearning4j.nn.multilayer.MultiLayerNetwork.calcBackpropGradients(MultiLayerNetwork.java:1984)
at org.deeplearning4j.nn.multilayer.MultiLayerNetwork.computeGradientAndScore(MultiLayerNetwork.java:2799)
at org.deeplearning4j.nn.multilayer.MultiLayerNetwork.computeGradientAndScore(MultiLayerNetwork.java:2742)
at org.deeplearning4j.optimize.solvers.BaseOptimizer.gradientAndScore(BaseOptimizer.java:174)
at org.deeplearning4j.optimize.solvers.StochasticGradientDescent.optimize(StochasticGradientDescent.java:61)
at org.deeplearning4j.optimize.Solver.optimize(Solver.java:52)
at org.deeplearning4j.nn.multilayer.MultiLayerNetwork.fitHelper(MultiLayerNetwork.java:2343)
at org.deeplearning4j.nn.multilayer.MultiLayerNetwork.fit(MultiLayerNetwork.java:2301)
at org.deeplearning4j.nn.multilayer.MultiLayerNetwork.fit(MultiLayerNetwork.java:2364)
at com.jufan.machinelearning.trainer.JoblogTrainer.AnalysisAndTraining(JoblogTrainer.java:189)
at com.jufan.machinelearning.trainer.JoblogTrainer.main(JoblogTrainer.java:50)
@Justin I kept telling you multiple times you need to use the sequence record reader for this not the normal one. Please take the time to read and understand what I told you.
If you don’t do that then I can assume you’re ignoring what I wrote and unfortunately that means helping you is a waste of time.
If it is because english is not your first language or some other issue please notify me of that and I can try to clarify things for you.
@agibsonccc Thank your telling multiple times to use the sequence record reader. and time to time reading your suggestion. By the key work “sequence record reader” and my tangle about TransformProcess.
I find a good example