Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/troublete/go-qndnn
quick 'n' dirty neural network (for practical use)
https://github.com/troublete/go-qndnn
ai deep-neural-networks go machine-learning relu sigmoid tanh
Last synced: 6 days ago
JSON representation
quick 'n' dirty neural network (for practical use)
- Host: GitHub
- URL: https://github.com/troublete/go-qndnn
- Owner: troublete
- License: mit
- Created: 2024-11-09T18:54:25.000Z (2 months ago)
- Default Branch: master
- Last Pushed: 2024-11-23T19:57:21.000Z (about 2 months ago)
- Last Synced: 2024-11-23T20:30:55.116Z (about 2 months ago)
- Topics: ai, deep-neural-networks, go, machine-learning, relu, sigmoid, tanh
- Language: Go
- Homepage:
- Size: 16.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-qndnn
> quick 'n' dirty neural network (for practical use)## Introduction
This package contains a simple Go implementation for neural networks; for practical everyday-use in common use-cases. It
is neither heavily optimized to be the best package around, nor does this package contain an exhaustive variety of
mathematical functions. It supports Sigmoid, Tanh and ReLU. It leverages Go primitives.```go
nn := qndnn.NewNeuralNet(nil, 4, 3, 3, 1) // sigmoid is default; input (4), hidden1 (3), hidden2 (3), output (1)
// qndnn.NewNeuralNet(qndnn.WithRelu(), 4, 3, 3, 1) // – to use with relu
// qndnn.NewNeuralNet(qndnn.WithTanh(), 4, 3, 3, 1) // - to use with tanh// to retrieve output with input values
out, err := nn.Output([]float64{1, 2, 3, 4})// to train on expectations
err = nn.Train(
[]Expectation{
{
Input: []float64{1, 2, 3, 4},
Output: []float64{.42},
},
},
0.01, // learning rate
qndnn.RoundStrategy(1000), // train for 1000 rounds; other options include ThresholdStrategy (see examples)
)serializedBase64, err := nn.Serialize() // to serialize net (weights, biases)
nn, err = NewNeuralNetFromSerialized(nil, serializedBase64) // deserialize serialized net into usable structure; initialized with sigmoid
//nn, err = NewNeuralNetFromSerialized(qndnn.WithRelu(), serializedBase64) // - to initialize with relu
//nn, err = NewNeuralNetFromSerialized(qndnn.WithTanh(), serializedBase64) // - to initialize with tanh
```