Skip to content

Go feed forward artificial neural network library

License

Notifications You must be signed in to change notification settings

aaparella/drago

Repository files navigation

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:

acts := drago.Activator[]{new(drago.Sigmoid), new(drago.Sigmoid)}
net := drago.New(0.1, 25, []int{5, 2, 2, 1}, acts)
net.Learn([][][]float64{
    {{0, 0}, {1}},
    {{0, 1}, {0}},
    {{1, 1}, {0}},
})

// Predict a value
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.

type YourActivationFunction struct {
}

func (y *YourActivationFunction) Apply(r, c int, val float64) float64 {
    // ...
}

func (y *YourActivationFunction) Derivative(r, c int, val float64) float64 {
    // ...
}

About

Go feed forward artificial neural network library

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages