Documentation ¶
Index ¶
- func ClassPredictionCorrect(out, exp *mat64.Vector) bool
- func CrossEntropyError(predicted, expected *mat64.Dense) float64
- func GetAbstractTimeSeries1() (input, expected *mat64.Dense)
- func GetAbstractTimeSeries2() (input, expected *mat64.Dense)
- func GetAbstractTimeSeries3() (input, expected *mat64.Dense)
- func GetAddVec(v1, v2 *mat64.Vector) *mat64.Vector
- func GetClassAccuracy(outputs []*mat64.Vector, expected *mat64.Dense) (float64, int)
- func GetDenseApply(m *mat64.Dense, cb func(float64) float64) *mat64.Dense
- func GetIris() (input, expected *mat64.Dense)
- func GetMaxIdx(v *mat64.Vector) int
- func GetMulElemVec(v1, v2 *mat64.Vector) *mat64.Vector
- func GetMulVec(m *mat64.Dense, v *mat64.Vector) *mat64.Vector
- func GetOuterVec(v1, v2 *mat64.Vector) *mat64.Dense
- func GetRandomDense(numSamples, length int) *mat64.Dense
- func GetRandomInRange(min, max float64) float64
- func GetRandomVector(length int) *mat64.Vector
- func GetSubVec(v1, v2 *mat64.Vector) *mat64.Vector
- func GetTransposed(m *mat64.Dense) *mat64.Dense
- func GetVectorApply(v *mat64.Vector, cb func(float64) float64) *mat64.Vector
- func GetVectorPow(v *mat64.Vector, power float64) *mat64.Vector
- func GetVectorSigmoid(v *mat64.Vector) *mat64.Vector
- func GetVectorSigmoidPrime(v *mat64.Vector) *mat64.Vector
- func GetVectorSoftmax(v *mat64.Vector) *mat64.Vector
- func GetVectorSum(v *mat64.Vector) float64
- func GetVectorTanh(v *mat64.Vector) *mat64.Vector
- func LoadFromCSV(path string, vectorLen int) (out *mat64.Dense)
- func MaxInt(a, b int) int
- func PrintDense(m *mat64.Dense)
- func PrintVector(v *mat64.Vector)
- func PrintVectorStrip(v *mat64.Vector)
- func PrintVectorStripSub(v *mat64.Vector, val float64, sub string)
- func RandomDense(min, max float64, m *mat64.Dense)
- func RandomVector(min, max float64, v *mat64.Vector)
- func SampleCrossEntropyError(predicted, expected *mat64.Vector) float64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClassPredictionCorrect ¶
func CrossEntropyError ¶
CrossEntropyError returns the total cross entropy error for a set of @predicted and @expected vectors. (Each row in those matrices is a vector-sample.)
func GetAbstractTimeSeries1 ¶
GetAbstractTimeSeries1Step creates a time-series dataset. The X sample pattern occurs twice in the dataset and predicts different things depending on the X-1 pattern. Thus a neural network needs to have at least a 1-step memory.
func GetAbstractTimeSeries2 ¶
GetAbstractTimeSeries2 creates a time-series dataset. The X sample pattern occurs twice in the dataset and predicts different things depending on the X-2 pattern. Thus a neural network needs to have at least a 2-step memory.
func GetAbstractTimeSeries3 ¶
func GetClassAccuracy ¶
func GetDenseApply ¶
GetDenseApply wraps mat64.Apply for dense matrices and returns a new vector. it slightly changes the API (see the callback signature).
func GetIris ¶
GetIris returns you X (samples) and Y (labels) for the Iris dataset. Labels are one-hot encoded.
func GetMulElemVec ¶
GetMulElemVec wraps mat64.MulElemVec and returns a new vector.
func GetOuterVec ¶
GetOuterVec wraps mat64.Outer and returns a new dense matrix.
func GetRandomDense ¶
GetRandomDense generates @numSamples of random vectors of length @length.
func GetRandomInRange ¶
GetRandomInRange returns a random float64 in [min, max].
func GetRandomVector ¶
GetRandomVector generates a random vector of length @length.
func GetTransposed ¶
GetTransposed returns a transposed Dense matrix.
func GetVectorApply ¶
GetVectorApply applies @cg to each element in @v.
func GetVectorPow ¶
GetVectorPow raises each element in @v to @power-th power.
func GetVectorSigmoid ¶
GetVectorSigmoid applies sigmoid function to each element in @v.
func GetVectorSigmoidPrime ¶
GetVectorSigmoidPrime returns derivative of VectorSigmoid.
func GetVectorSoftmax ¶
GetVectorSoftmax sets the softmax value for each element in @v.
func GetVectorSum ¶
GetVectorSum returns the sum of all elements in @v.
func GetVectorTanh ¶
GetVectorTanh applies hyperbolic tangent to each element in @v.
func LoadFromCSV ¶
LoadFromCSV returns a matrix restored from a file (@path) which must be a valid csv with each line representing a float64-vector of length @vectorLen.
func PrintVector ¶
PrintVector pretty prints @v and adds a newline.
func PrintVectorStripSub ¶
PrintVectorStripSub is a stupid function that substitutes each component of @v that is equal to @val with @sub. This is used mostly for better visualizing time-series patterns.
func RandomDense ¶
RandomDense fills each cell of a matrix with random numbers in [min, max].
func RandomVector ¶
RandomVector fills each component of a vector with random numbers in [min, max].
func SampleCrossEntropyError ¶
SampleCrossEntropyError calculates the error for a sample given a @predicted and @expected vector. If the prediction for a sample is [0.3, 0.3, 0.4] and the expected output is [.0, .0, 1.], then the cross entropy error is calculated as -( (ln(0.3)*0) + (ln(0.3)*0) + (ln(0.4)*1) ) = -ln(0.4).
Types ¶
This section is empty.