Skip to content

Instantly share code, notes, and snippets.

@pjazdzewski1990

pjazdzewski1990/dsl.scala

Last active Aug 29, 2015
Embed
What would you like to do?
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
You can’t perform that action at this time.