internalmath

package
v0.0.0-...-8085192 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CDF

func CDF(probablities []float64) []float64

func Cost

func Cost(expected, output float64) float64

func CostDerivative

func CostDerivative(expected, output float64) float64

func CostVector

func CostVector(expected *Vector[float64], output *Vector[float64]) float64

func FindIndexFromRight

func FindIndexFromRight(val float64, cdf []float64) int

func IndexChoice

func IndexChoice(probabilities []float64, count int) []int

func QuadraticCost

func QuadraticCost(trainingInputCount uint64, expected *Vector[float64], output *Vector[float64]) float64

func Sigmoid

func Sigmoid(n float64) float64

func SigmoidDerivative

func SigmoidDerivative(n float64) float64

Types

type Matrix

type Matrix struct {
	Values []float64
	Width  int
	Height int
}

func CreateMatrix

func CreateMatrix(width, height int) *Matrix

func (*Matrix) Add

func (m *Matrix) Add(other *Matrix) *Matrix

func (*Matrix) Get

func (m *Matrix) Get(x, y int) float64

func (*Matrix) GetRow

func (m *Matrix) GetRow(row int) []float64

func (*Matrix) Mul

func (m *Matrix) Mul(other *Matrix) *Matrix

func (*Matrix) Set

func (m *Matrix) Set(x, y int, value float64)

func (*Matrix) Sub

func (m *Matrix) Sub(other *Matrix) *Matrix

type Vector

type Vector[T constraints.Float] struct {
	Data []T
}

func CreateVector

func CreateVector[T constraints.Float](values ...T) *Vector[T]

func CreateVectorWithSize

func CreateVectorWithSize[T constraints.Float](size int) *Vector[T]

func (*Vector[T]) Add

func (v *Vector[T]) Add(other *Vector[T]) *Vector[T]

func (*Vector[T]) Copy

func (v *Vector[T]) Copy() *Vector[T]

func (*Vector[T]) Div

func (v *Vector[T]) Div(other interface{}) *Vector[T]

func (*Vector[T]) Dot

func (v *Vector[T]) Dot(other *Vector[T]) T

func (*Vector[T]) Length

func (v *Vector[T]) Length() float64

func (*Vector[T]) Magnitude

func (v *Vector[T]) Magnitude() T

func (*Vector[T]) Mul

func (v *Vector[T]) Mul(other interface{}) *Vector[T]

func (*Vector[T]) Normalize

func (v *Vector[T]) Normalize() *Vector[T]

func (*Vector[T]) Push

func (v *Vector[T]) Push(data T)

func (*Vector[T]) Size

func (v *Vector[T]) Size() int

func (*Vector[T]) Sub

func (v *Vector[T]) Sub(other *Vector[T]) *Vector[T]

func (*Vector[T]) ToString

func (v *Vector[T]) ToString() string

Jump to

Keyboard shortcuts

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