org.ea.javacnn
Class JavaCNN
- java.lang.Object
-
- org.ea.javacnn.JavaCNN
-
- All Implemented Interfaces:
- java.io.Serializable
public class JavaCNN extends java.lang.Object implements java.io.SerializableA network class holding the layers and some helper functions for training and validation.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description doublebackward(int y)Backprop: compute gradients wrt all parametersDataBlockforward(DataBlock db, boolean training)java.util.List<BackPropResult>getBackPropagationResult()Accumulate parameters and gradients for the entire networkdoublegetCostLoss(DataBlock db, int y)intgetPrediction()This is a convenience function for returning the argmax prediction, assuming the last layer of the net is a softmaxjava.lang.StringgetPredictions(int[] correctPredictions, int[] numberDistribution, int totalSize, int numOfClasses)Print prediction.static JavaCNNloadModel(java.lang.String fileName)Load the model of this neural network from a file.voidsaveModel(java.lang.String fileName)Save convolutional network to a file.
-
-
-
Constructor Detail
-
JavaCNN
public JavaCNN(java.util.List<Layer> layers)
-
-
Method Detail
-
getCostLoss
public double getCostLoss(DataBlock db, int y)
-
backward
public double backward(int y)
Backprop: compute gradients wrt all parameters
-
getBackPropagationResult
public java.util.List<BackPropResult> getBackPropagationResult()
Accumulate parameters and gradients for the entire network
-
getPrediction
public int getPrediction()
This is a convenience function for returning the argmax prediction, assuming the last layer of the net is a softmax
-
getPredictions
public java.lang.String getPredictions(int[] correctPredictions, int[] numberDistribution, int totalSize, int numOfClasses)Print prediction.
-
saveModel
public void saveModel(java.lang.String fileName)
Save convolutional network to a file.- Parameters:
fileName- output file name.
-
loadModel
public static JavaCNN loadModel(java.lang.String fileName)
Load the model of this neural network from a file.- Parameters:
fileName- input file name- Returns:
-
-
DataMelt 3.0 © DataMelt by jWork.ORG