All Downloads are FREE. Search and download functionalities are using the official Maven repository.

neuroflow.playground.SigGap.scala Maven / Gradle / Ivy

There is a newer version: 0.500
Show newest version
package neuroflow.playground

import neuroflow.core.Activator.Sigmoid
import neuroflow.core.FFN.WeightProvider._
import neuroflow.core._
import neuroflow.nets.DefaultNetwork._
import shapeless._

/**
  * @author bogdanski
  * @since 03.01.16
  */
object SigGap {

  /*

      This is a shallow neural net.
      The closed form solution is -a +a or +a -a for both weights,
      so the goal is to find weights that are close to this exact shape.

  */

  def apply = {

    val settings = Settings(learningRate = 0.1, precision = 1E-20, iterations = 100000)
    val net = Network(Input(2) :: Output(1, Sigmoid) :: HNil, settings)
    net.train(Seq(Seq(0.3, 0.3)), Seq(Seq(0.5)))

    println("Output: " + net.evaluate(Seq(0.3, 0.3)))
    println("Parameters must roughly be of shape: -a, +a or +a, -a")
    println("Network was " + net)

  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy