elm

package
v0.0.0-...-1a937e6 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dot

func Dot(a []float64, b []float64) float64

Dot calculates the dot product between a and n

func EvaluateLayer

func EvaluateLayer(neurons []Neuron, x []float64) []float64

EvaluateLayer evaluates the outut of each layer

func HiddenLayerMatrix

func HiddenLayerMatrix(X *mat.Dense, neurons []Neuron) *mat.Dense

HiddenLayerMatrix calculates the matrix of a hidden layer given a matrix of input Each row of X corresponds to an input vector to the layer.

func Relu

func Relu(x float64) float64

Relu is a rectifying function returnin max(0, x)

func Sigmoid

func Sigmoid(x float64) float64

Sigmoid is 1/(1+e^{-x})

Types

type ActivationFunc

type ActivationFunc func(x float64) float64

ActivationFunc function is a function that takes a value as input and returns a float value corresponding to the output of a neuron

type Neuron

type Neuron struct {
	Weights        []float64
	ActivationFunc ActivationFunc
}

Neuron represents a neuron

func RandomNeuronFactory

func RandomNeuronFactory(n int, rng *rand.Rand, a ActivationFunc) Neuron

RandomNeuronFactory creates a neuron with randomly initialized weights

func RandomReluNeuronFactory

func RandomReluNeuronFactory(n int, rng *rand.Rand) Neuron

RandomReluNeuronFactory is a convenience function that produce a neuron with random weights and a relu activation function

func RandomSigmoidNeuronFactory

func RandomSigmoidNeuronFactory(n int, rng *rand.Rand) Neuron

RandomSigmoidNeuronFactory is a convenience function that produce a neuron with random weights and a sigmoid activation

func (Neuron) Activation

func (n Neuron) Activation(x []float64) float64

Activation calculates the actuvation of the current neuron

Jump to

Keyboard shortcuts

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