edu.hitsz.c102c.cnn
Class CNN
- java.lang.Object
-
- edu.hitsz.c102c.cnn.CNN
-
- All Implemented Interfaces:
- java.io.Serializable
public class CNN extends java.lang.Object implements java.io.SerializableMain class to build a comvolutional neural network.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static classCNN.LayerBuilderThe constructor mode constructs layers.
-
Constructor Summary
Constructors Constructor and Description CNN(CNN.LayerBuilder layerBuilder, int batchSize)Initialize the convolutional neural network.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description static CNNloadModel(java.lang.String fileName)Load the model of this neural network from a file.voidpredict(Dataset testset, java.lang.String fileName)Write a file with predicted lables.voidsaveModel(java.lang.String fileName)Save convolutional network to a file.voidsetup(int batchSize)Set the parameters of each layer of the CNN network.doubletest(Dataset trainset)Test trained neural network.voidtrain(Dataset trainset, int repeat)Train the network on the training set
-
-
-
Constructor Detail
-
CNN
public CNN(CNN.LayerBuilder layerBuilder, int batchSize)
Initialize the convolutional neural network.- Parameters:
layerBuilder- Network layerinputMapSize- Enter the size of the mapclassNum- The number of categories, the data set is required to convert the class label to a value of 0-classNum-1
-
-
Method Detail
-
train
public void train(Dataset trainset, int repeat)
Train the network on the training set- Parameters:
trainset-repeat- The number of iterations
-
test
public double test(Dataset trainset)
Test trained neural network.- Parameters:
trainset-- Returns:
- precison of training.
-
predict
public void predict(Dataset testset, java.lang.String fileName)
Write a file with predicted lables.- Parameters:
testset- test dataset.fileName- ouput file with predicted lables.
-
setup
public void setup(int batchSize)
Set the parameters of each layer of the CNN network.- Parameters:
batchSize- * @param classNuminputMapSize-
-
saveModel
public void saveModel(java.lang.String fileName)
Save convolutional network to a file.- Parameters:
fileName- output file name.
-
loadModel
public static CNN 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