Skip to content

Instantly share code, notes, and snippets.

@shenkev
Created December 3, 2016 23:27
Show Gist options
  • Save shenkev/ae7b3a4bebf64f0a232e4be63b0310b2 to your computer and use it in GitHub Desktop.
Save shenkev/ae7b3a4bebf64f0a232e4be63b0310b2 to your computer and use it in GitHub Desktop.
Neural Network configuration
double regularize = 0.000001;
double dropOut = 0.0;
int numEpochs = 3000;
int batchSize = 2000;
int printEvery = Xarr.length/batchSize;
// Dimensions
int features = 13;
int lay1 = 100;
int lay2 = 6;
int outs = 6;
final DataSet allData = new DataSet(X,y);
final List<DataSet> list = allData.asList();
Collections.shuffle(list, rng);
DataSetIterator iterator = new ListDataSetIterator(list, batchSize);
MultiLayerConfiguration conf = new NeuralNetConfiguration.Builder()
.seed(rngSeed)
.optimizationAlgo(algo)
.iterations(iterations)
.activation(hiddenAct)
.weightInit(WeightInit.XAVIER_FAN_IN)
.updater(updater)
.regularization(true).l2(regularize).dropOut(dropOut)
.list()
.layer(0, new DenseLayer.Builder()
.learningRate(10)
.momentum(5)
.nIn(features)
.nOut(lay1)
.build())
// .layer(1, new DenseLayer.Builder()
// .learningRate(3.0)
// .momentum(5.0)
// .nIn(lay1)
// .nOut(lay2)
// .build())
.layer(1, new OutputLayer.Builder(LossFunction.SQUARED_LOSS)
.activation(outAct)
.learningRate(6)
.momentum(6)
.nIn(lay1)
.nOut(outs)
.build())
.pretrain(false).backprop(true)
.build();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment