Skip to content

Instantly share code, notes, and snippets.

View pjazdzewski1990's full-sized avatar

Patryk Jażdżewski pjazdzewski1990

View GitHub Profile
object ClassicRunner {
def run() = {
val input = Array(
Array( 0.0, 0.0 ),
Array( 1.0, 0.0 ),
Array( 0.0, 1.0 ),
Array( 1.0, 1.0 )
)
val ideal = Array(
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) \\
val b = (1.0 | 2.0 | 3.0) \\
(4.0 | 5.0 | 6.0) \\
(7.0 | 8.0 | 9.0)
//gives
// 1.0 2.0 3.0
// 4.0 5.0 6.0
// 7.0 8.0 9.0
implicit class EncogArray1[T](val elem1: T) {
def |(v: T) = new EncogArray2[T](elem1, v)
}
case class EncogArray2[T](elem1: T, elem2: T) {
def |(v: T) = new EncogArray3[T](elem1, elem2, v)
}
case class EncogArray3[T](elem1: T, elem2: T, elem3: T) {
def |(v: T) = new EncogArray4[T](elem1, elem2, elem3, v)
}
case class EncogArray4[T](elem1: T, elem2: T, elem3: T, elem4: T) {
implicit class EncogArray1[T](val elem1: T) {
def |(v: T) = new EncogArray2[T](elem1, v)
}
case class EncogArray2[T](elem1: T, elem2: T) {
def |(v: T) = new EncogArray3[T](elem1, elem2, v)
}
case class EncogArray3[T](elem1: T, elem2: T, elem3: T) {
def |(v: T) = new EncogArray4[T](elem1, elem2, elem3, v)
}
case class EncogArray4[T](elem1: T, elem2: T, elem3: T, elem4: T) {
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()
val a = Array (
Array(1,2,3),
Array(4,5),
Array(6)
)
//gives
// 1 2 3
// 4 5
// 6
def receive: PartialFunction[Any, Unit]
Total {
case Eat(food)
println(s"Tasty $food!")
Stopped
case Wait()
Same
}