Skip to content

Instantly share code, notes, and snippets.

Avatar

Patryk Jażdżewski pjazdzewski1990

View GitHub Profile
View Xor.scala
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(
View dsl.scala
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) \\
View matrix2.scala
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
View Arrays
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) {
View Arrays.scala
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) {
View Network.scala
val network =
(InputLayer having bias having 2.layers) +
(ActivationSigmoid having bias having 3.layers) +
(ActivationSigmoid having 1.layers)
View Process.scala
val procedure = input into network using (d => new ResilientPropagation(d.network, d.data)) until (_ < 0.01) giving ideal
val trainResult = procedure.get()
View matrix1.scala
val a = Array (
Array(1,2,3),
Array(4,5),
Array(6)
)
//gives
// 1 2 3
// 4 5
// 6
View Receive.scala
def receive: PartialFunction[Any, Unit]
View Total.scala
Total {
case Eat(food)
println(s"Tasty $food!")
Stopped
case Wait()
Same
}
You can’t perform that action at this time.