Last active
August 29, 2015 14:21
-
-
Save pjazdzewski1990/941a47c7b4cdfde0d0d9 to your computer and use it in GitHub Desktop.
This file contains 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
def run() = { | |
val input = | |
( 0.0 | 0.0 ) \\ | |
( 1.0 | 0.0 ) \\ | |
( 0.0 | 1.0 ) \\ | |
( 1.0 | 1.0 ) | |
val ideal = | |
Tuple1(0.0) \\ | |
(1.0) \\ | |
(1.0) \\ | |
(0.0) | |
val network = | |
(InputLayer having bias having 2.layers) + | |
(ActivationSigmoid having bias having 3.layers) + | |
(ActivationSigmoid having 1.layers) | |
val procedure = input into network using (d => new ResilientPropagation(d.network, d.data)) until (_ < 0.01) giving ideal | |
val trainResult = procedure.get() | |
System.out.println("Neural Network Results for DSL:") | |
for { pair <- trainResult.trainingSet.getData() } { | |
val output = trainResult.trainedNetwork.compute(pair.getInput()) | |
println(pair.getInput().getData(0) + "," + pair.getInput().getData(1) | |
+ ", actual=" + output.getData(0) + ",ideal=" + pair.getIdeal().getData(0)); | |
} | |
Encog.getInstance().shutdown() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment