nn

package
v0.0.0-...-dd927f3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 7, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Sigmoid

func Sigmoid(x float64) float64

Sigmoid 激活函数及其导数

func SigmoidDerivative

func SigmoidDerivative(x float64) float64

Types

type Layer

type Layer struct {
	// contains filtered or unexported fields
}

Layer structure

func (*Layer) Forward

func (l *Layer) Forward(inputs []float64) []float64

Forward pass for a layer

type NeuralNetwork

type NeuralNetwork struct {
	// contains filtered or unexported fields
}

NeuralNetwork structure

func NewNeuralNetwork

func NewNeuralNetwork(structure []int) *NeuralNetwork

Initialize the network with the number of neurons in each layer

func (*NeuralNetwork) BackPropagate

func (nn *NeuralNetwork) BackPropagate(inputs []float64, expected []float64, learnRate float64)

Backpropagation and weight update

func (*NeuralNetwork) Forward

func (nn *NeuralNetwork) Forward(inputs []float64) []float64

Forward pass for the network

type Neuron

type Neuron struct {
	Weights []float64
	Bias    float64
}

Neuron structure

func (*Neuron) Forward

func (n *Neuron) Forward(inputs []float64) float64

Forward pass for a neuron

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL