Created
October 15, 2015 11:03
-
-
Save Shmuma/1a590002ee8c22eca5ad to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static MultiLayerNetwork createRBMModel(int iterations, int features, int hidden) { | |
| MultiLayerConfiguration conf = new NeuralNetConfiguration.Builder() | |
| .seed(123) | |
| .iterations(iterations) | |
| .learningRate(1e-1) | |
| .optimizationAlgo(OptimizationAlgorithm.STOCHASTIC_GRADIENT_DESCENT) | |
| .constrainGradientToUnitNorm(true) | |
| .momentum(0.9) | |
| .list(2) | |
| .layer(0, new RBM.Builder(RBM.HiddenUnit.RECTIFIED, RBM.VisibleUnit.GAUSSIAN) | |
| .nIn(features) | |
| .nOut(hidden) | |
| .weightInit(WeightInit.XAVIER) | |
| .k(1) | |
| .activation("relu") | |
| .lossFunction(LossFunctions.LossFunction.MSE) | |
| .build()) | |
| .layer(1, new OutputLayer.Builder(LossFunctions.LossFunction.MSE) | |
| .nIn(hidden) | |
| .nOut(1) | |
| .activation("identity") | |
| .build() | |
| ) | |
| .build(); | |
| return new MultiLayerNetwork(conf); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment