Lloyd_159
Lloyd_159
JCHJava Community | Help. Code. Learn.
Created by Lloyd_159 on 9/29/2024 in #java-help
CNN for 1x8x8 Matrix outputs weird values?
I'm currently trying to create a CNN network with deeplearning4j which is supposed to evaluate chess games, it has a double[][] with one channel as Input and a single double value as output. My training input data consists of double[][] onjects which are filled with the numbers -6.0 to 6.0 for the chess figures (-6.0 mean black king, 6.0 mean white king, 0.0 is an empty field) and the output data are centipawns, usually between -1000 and 1000 (negative numbers stand for an advantage for black, positive for white). Tho there are some centipawns beyond that like -20000 if someone has a really extreme advantage and even the maximum integer valua if there's a checkmate. Now I try to train my CNN to calculate a centipawn for a Chess board, tho it only outputs positive insanly high numbers like 1.0E9... Anybody knows how to fix that or what I could try?
84 replies
JCHJava Community | Help. Code. Learn.
Created by Lloyd_159 on 9/27/2024 in #java-help
Exception CNN neural network with java
I am trying to create a neural network in java using deeplearning4j, but I keep getting an error when trying to create the network.
[main] INFO org.deeplearning4j.nn.multilayer.MultiLayerNetwork - Starting MultiLayerNetwork with WorkspaceModes set to [training: ENABLED; inference: ENABLED], cacheMode set to [NONE]
Exception in thread "main" org.deeplearning4j.exception.DL4JInvalidInputException: Input that is not a matrix; expected matrix (rank 2), got rank 4 array with shape [3, 16, 3, 3]. Missing preprocessor or wrong input type? (layer name: layer2, layer index: 2, layer type: DenseLayer)
at org.deeplearning4j.nn.layers.BaseLayer.preOutputWithPreNorm(BaseLayer.java:312)
at org.deeplearning4j.nn.layers.BaseLayer.preOutput(BaseLayer.java:295)
at org.deeplearning4j.nn.layers.BaseLayer.activate(BaseLayer.java:343)
at org.deeplearning4j.nn.layers.AbstractLayer.activate(AbstractLayer.java:262)
at org.deeplearning4j.nn.multilayer.MultiLayerNetwork.ffToLayerActivationsInWs(MultiLayerNetwork.java:1138)
at org.deeplearning4j.nn.multilayer.MultiLayerNetwork.computeGradientAndScore(MultiLayerNetwork.java:2783)
at org.deeplearning4j.nn.multilayer.MultiLayerNetwork.computeGradientAndScore(MultiLayerNetwork.java:2741)
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:1752)
at org.deeplearning4j.nn.multilayer.MultiLayerNetwork.fit(MultiLayerNetwork.java:1673)
at de.RolandHoeckenschnieder.TryTwo.ChessCNN.main(ChessCNN.java:130)
[main] INFO org.deeplearning4j.nn.multilayer.MultiLayerNetwork - Starting MultiLayerNetwork with WorkspaceModes set to [training: ENABLED; inference: ENABLED], cacheMode set to [NONE]
Exception in thread "main" org.deeplearning4j.exception.DL4JInvalidInputException: Input that is not a matrix; expected matrix (rank 2), got rank 4 array with shape [3, 16, 3, 3]. Missing preprocessor or wrong input type? (layer name: layer2, layer index: 2, layer type: DenseLayer)
at org.deeplearning4j.nn.layers.BaseLayer.preOutputWithPreNorm(BaseLayer.java:312)
at org.deeplearning4j.nn.layers.BaseLayer.preOutput(BaseLayer.java:295)
at org.deeplearning4j.nn.layers.BaseLayer.activate(BaseLayer.java:343)
at org.deeplearning4j.nn.layers.AbstractLayer.activate(AbstractLayer.java:262)
at org.deeplearning4j.nn.multilayer.MultiLayerNetwork.ffToLayerActivationsInWs(MultiLayerNetwork.java:1138)
at org.deeplearning4j.nn.multilayer.MultiLayerNetwork.computeGradientAndScore(MultiLayerNetwork.java:2783)
at org.deeplearning4j.nn.multilayer.MultiLayerNetwork.computeGradientAndScore(MultiLayerNetwork.java:2741)
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:1752)
at org.deeplearning4j.nn.multilayer.MultiLayerNetwork.fit(MultiLayerNetwork.java:1673)
at de.RolandHoeckenschnieder.TryTwo.ChessCNN.main(ChessCNN.java:130)
56 replies
JCHJava Community | Help. Code. Learn.
Created by Lloyd_159 on 11/27/2023 in #java-help
Are variables objects?
Since I started learning java, I often heart "unlike in other programming languages like python, in java variables are in fact called objects." So I always used the term object to describe variables like int i = 5, but now I heart other people saying other things. So I want to make sure? Are variables in java called objects, are they a special kind of object or are obects and variables two different things?
8 replies