Documentation ¶
Overview ¶
Package neuralnet provides basic feed-forward mlp neural-networks
Index ¶
Constants ¶
This section is empty.
Variables ¶
var R *rand.Rand
R is the source to be used for the initial random weights
Functions ¶
This section is empty.
Types ¶
type NeuralNetwork ¶
type NeuralNetwork struct {
// contains filtered or unexported fields
}
NeuralNetwork that contains layers, neurons and biases. It provides a fully connected network for supervised learning
func LoadNeuralNetwork ¶
func LoadNeuralNetwork(r io.Reader) (*NeuralNetwork, error)
LoadNeuralNetwork returns a previously dumped network based on the encoded data from the io.Reader r
func NewNeuralNetwork ¶
func NewNeuralNetwork(layers []uint) *NeuralNetwork
NewNeuralNetwork returns a randomized network with the specified number of layers and neurons. Example: []uint{6, 3, 2, 2} would create a network with 6 input neurons, 2 hidden layers with 3 and 2 neurons and an output layer with 2 neurons
func (*NeuralNetwork) Dump ¶
func (n *NeuralNetwork) Dump(w io.Writer) error
Dump marshals the neural network to json and writes it to the specified io.Writer w
func (*NeuralNetwork) Predict ¶
func (n *NeuralNetwork) Predict(input []float64) []float64
Predict will feedforward the input and then return the prediction
func (*NeuralNetwork) Train ¶
func (n *NeuralNetwork) Train(input, output []float64, eta float64)
Train will feedforward the input and then backpropagate to reduce error on output using learning rate eta