matrix

package
v0.0.0-...-ebc0b1d Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2016 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddBias

func AddBias(m mat64.Matrix) *mat64.Dense

AddBias adds a bias unit (either a vector or a single unit) to mat64.Matrix and returns the new augmented matrix without modifying the original one

func AddMx

func AddMx(f float64) func(int, int, float64) float64

AddMx allows to add an arbitrary number to all matrix elements

func ColSums

func ColSums(m *mat64.Dense) []float64

ColSums returns a slice of sums of all elemnts in each matrix column It returns nil if passed in matrix is nil or has zero elements

func ColsMax

func ColsMax(m *mat64.Dense) []float64

ColsMax returns a slice of max values per each matrix column It returns nil if passed in matrix is nil or has zero elements

func ExpMx

func ExpMx(i, j int, x float64) float64

ExpMx allows to calculate exponential of matrix elements

func LogMx

func LogMx(i, j int, x float64) float64

LogMx allows to calculate log of each matrix element

func MakeLabelsMx

func MakeLabelsMx(labels *mat64.Vector, expLabels int) (*mat64.Dense, error)

MakeLabelsMx creates a 1-of-N matrix from the supplied vector of labels Labels matrix has the following dimensions: labels.Len() x expLabels It does not modify the supplied matrix of labels. It returns error if the number of labels is negative integer or if one of the labels is non-positive or is greater than number of labels

func MakeRandMx

func MakeRandMx(rows, cols int, min, max float64) (*mat64.Dense, error)

MakeRandMx creates a new matrix with of size rows x cols that is initialized to random number uniformly distributed in interval (min, max)

func Mx2Vec

func Mx2Vec(m *mat64.Dense, byRow bool) []float64

Mx2Vec unrolls all elements of matrix into a slice and returns it. Matrix elements can be unrolled either by row or by a column.

func Ones

func Ones(rows, cols int) *mat64.Dense

Ones returns a matrix of rows x cols filled with 1.0

func PowMx

func PowMx(f float64) func(int, int, float64) float64

PowMx allows to calculate power of matrix elements

func ReluGradMx

func ReluGradMx(i, j int, x float64) float64

ReluGradMx provides Relu a "derlivation" used in backpropagation algorithm

func ReluMx

func ReluMx(i, j int, x float64) float64

ReluMx allows to apply Relu to all matrix elements

func RowSums

func RowSums(m *mat64.Dense) []float64

RowSums returns a slice of sums of all elemnts in each matrix row It returns nil if passed in matrix is nil or has zero elements

func RowsMax

func RowsMax(m *mat64.Dense) []float64

RowsMax returns a slice of max values per each matrix row It returns nil if passed in matrix is nil or has zero elements

func SetMx2Vec

func SetMx2Vec(mx *mat64.Dense, vec []float64, byRow bool) (err error)

SetMx2Vec sets all elements of a matrix to values stored in a slice passed in as a parameter. It fails with error if number of elements of the matrix is bigger than number of elements of the slice.

func Sigmoid

func Sigmoid(x float64) float64

Sigmoid provides sigmoid activation function

func SigmoidGrad

func SigmoidGrad(x float64) float64

SigmoidGrad provides sigmoid derivation used in backprop algorithm

func SigmoidGradMx

func SigmoidGradMx(i, j int, x float64) float64

SigmoidGradMx allows to apply Sigmoidd derivation func to all matrix elements

func SigmoidMx

func SigmoidMx(i, j int, x float64) float64

SigmoidMx allows to apply sigmoid func to all matrix elements

func SubtrMx

func SubtrMx(f float64) func(int, int, float64) float64

SubtrMx allows to subtract a number from all matrix elements

func TanhGradMx

func TanhGradMx(i, j int, x float64) float64

TanhGradMx provides Tanh derivation used in backpropagation algorithm

func TanhMx

func TanhMx(i, j int, x float64) float64

TanhMx allows to apply tanh function to all matrix elements

func TanhOutMx

func TanhOutMx(i, j int, x float64) float64

TanhOutMx re-scales sigmoid function so that Tanh can be used in Output layer for neural network classifiers

Types

This section is empty.

Jump to

Keyboard shortcuts

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