Skip to content

Instantly share code, notes, and snippets.

@agibsonccc
Created January 13, 2017 04:06
Show Gist options
  • Save agibsonccc/20c60be963558a4c48fcb130813202ae to your computer and use it in GitHub Desktop.
Save agibsonccc/20c60be963558a4c48fcb130813202ae to your computer and use it in GitHub Desktop.
protected void buildModel(){
switch (modelType) {
case "MLP":
// NSLKDD got .98% with 512, RMSProp & leakyrelu
BasicMLPModel mlpmodel = new BasicMLPModel(
new int[]{nIn, 256, 256},
new int[]{256, 256, nOut},
iterations,
"leakyrelu",
WeightInit.XAVIER,
OptimizationAlgorithm.STOCHASTIC_GRADIENT_DESCENT,
Updater.NESTEROVS,
LossFunctions.LossFunction.MCXENT,
1e-2,
1e-5,
0.9,
seed);
conf = mlpmodel.conf();
network = mlpmodel.buildModel(conf);
supervised = true;
break;
case "RNN":
// reference: http://sacj.cs.uct.ac.za/index.php/sacj/article/viewFile/248/150
// partial config for this and from examples repo
// use 1000 epochs
BasicRNNModel rnnmodel = new BasicRNNModel(
new int[]{nIn, 10, 10},
new int[]{10, 10, nOut},
iterations,
"softsign",
WeightInit.XAVIER,
OptimizationAlgorithm.STOCHASTIC_GRADIENT_DESCENT,
Updater.RMSPROP,
LossFunctions.LossFunction.MCXENT,
learningRate,
1e-3,
truncatedBPTTLength,
seed);
conf = rnnmodel.conf();
network = rnnmodel.buildModel(conf);
supervised = true;
break;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment