public static Network CreateNetworkMaxout(GPUModule module, int minibatchSize) { var net = new Network(module, minibatchSize: minibatchSize); net.AddInputLayer(Constants.TOTAL_VALUE_COUNT, sparseDataSize: minibatchSize * RawRecord.FEATURE_COUNT * 2); net.AddLabelLayer(1); var fc1 = net.AddFullyConnectedLayer(128, "FC1"); fc1.Weights.InitValuesUniformCPU(0.1f); fc1.L2Regularization = 0.00001f; fc1.RegularizationRatio = 10; net.AddMaxoutLayer("MAXOUT1", groupsize: 4); var fc2 = net.AddFullyConnectedLayer(256, "FC2"); fc2.Weights.InitValuesUniformCPU(0.1f); net.AddMaxoutLayer("MAXOUT2", groupsize: 2); net.AddDropoutLayer(); var sm = net.AddSoftmaxLayer(2, "SMAX"); sm.Weights.InitValuesUniformCPU(0.1f); return(net); }
public void CNNTest() { network.AddInputLayer(7, 1); network.AddConvolutionLayer(2, 2); network.AddPoolingLayer(2); network.AddActivationLayer(ActivatorType.Relu); network.AddConvolutionLayer(3, 2); network.AddPoolingLayer(2); network.AddActivationLayer(ActivatorType.Relu); network.AddFlattenLayer(); network.AddDenseLayer(5, true); network.AddActivationLayer(ActivatorType.Relu); network.AddDenseLayer(3, false); network.AddSoftMaxLayer(); TestNetwork(network, "test1"); }
private static Network CreateModel() { var network = new Network(LossFunctionType.CrossEntropy, new Flat(0.001), NumberOfClasses); network.AddInputLayer(28, 1); network.AddConvolutionLayer(16, 5); network.AddActivationLayer(ActivatorType.Relu); network.AddPoolingLayer(2); network.AddConvolutionLayer(32, 5); network.AddActivationLayer(ActivatorType.Relu); network.AddPoolingLayer(2); network.AddFlattenLayer(); network.AddDenseLayer(1024, true); network.AddActivationLayer(ActivatorType.Relu); network.AddDenseLayer(NumberOfClasses, false); network.AddSoftMaxLayer(); network.RandomizeWeights(0.1); return(network); }