项目作者: aaparella

项目描述 :
Go feed forward artificial neural network library
高级语言: Go
项目地址: git://github.com/aaparella/drago.git
创建时间: 2015-12-20T03:43:57Z
项目社区:https://github.com/aaparella/drago

开源协议:MIT License

下载


drago

Go Report Card

Simple feed forward neural network implementation. Still need to add some nice utility functions, the logic can stand to be cleaned up in some places, but the algorithms are implemented and it can be used.

Usage:

  1. acts := drago.Activator[]{new(drago.Sigmoid), new(drago.Sigmoid)}
  2. net := drago.New(0.1, 25, []int{5, 2, 2, 1}, acts)
  3. net.Learn([][][]float64{
  4. {{0, 0}, {1}},
  5. {{0, 1}, {0}},
  6. {{1, 1}, {0}},
  7. })
  8. // Predict a value
  9. fmt.Println(net.Predict([]float64{1, 1})

To add an activation function:

An activation function needs both the function and it’s derivative. See Sigmoid.go, Tanh.go, and ReLU.go for examples of this.

  1. type YourActivationFunction struct {
  2. }
  3. func (y *YourActivationFunction) Apply(r, c int, val float64) float64 {
  4. // ...
  5. }
  6. func (y *YourActivationFunction) Derivative(r, c int, val float64) float64 {
  7. // ...
  8. }