Documentation ¶
Overview ¶
Package norm provides normalization and norm metric computations e.g., L2 = sqrt of sum of squares of a vector.
DivNorm does divisive normalization of elements SubNorm does subtractive normalization of elements ZScore subtracts the mean and divides by the standard deviation
Index ¶
- func Abs32(a []float32)
- func Abs64(a []float64)
- func AbsTensor(a tensor.Tensor)
- func AddVec64(a []float64, val float64)
- func AddVector32(a []float32, val float32)
- func Binarize32(a []float32, thr, hiVal, loVal float32)
- func Binarize64(a []float64, thr, hiVal, loVal float64)
- func DivNorm32(a []float32, nfunc Func32)
- func DivNorm64(a []float64, nfunc Func64)
- func FloatFunc(tsr tensor.Tensor, nfunc32 Func32, nfunc64 Func64, stIdx, nIdx int, ...)
- func FloatOnlyError() error
- func MultVec64(a []float64, val float64)
- func MultVector32(a []float32, val float32)
- func SubNorm32(a []float32, nfunc Func32)
- func SubNorm64(a []float64, nfunc Func64)
- func TensorDivNorm(tsr tensor.Tensor, ndim int, nfunc32 Func32, nfunc64 Func64)
- func TensorSubNorm(tsr tensor.Tensor, ndim int, nfunc32 Func32, nfunc64 Func64)
- func TensorUnit(tsr tensor.Tensor, ndim int)
- func TensorZScore(tsr tensor.Tensor, ndim int)
- func Thresh32(a []float32, hi bool, hiThr float32, lo bool, loThr float32)
- func Thresh64(a []float64, hi bool, hiThr float64, lo bool, loThr float64)
- func Unit32(a []float32)
- func Unit64(a []float64)
- func ZScore32(a []float32)
- func ZScore64(a []float64)
- type Func32
- type Func64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AbsTensor ¶
AbsTensor applies the Abs function to each element in given tensor, for float32 and float64 data types.
func Binarize32 ¶
Binarize32 turns vector into binary-valued, by setting anything >= the threshold to the high value, and everything below to the low value.
func Binarize64 ¶
Binarize64 turns vector into binary-valued, by setting anything >= the threshold to the high value, and everything below to the low value.
func DivNorm32 ¶
DivNorm32 does divisive normalization by given norm function i.e., it divides each element by the norm value computed from nfunc.
func DivNorm64 ¶
DivNorm64 does divisive normalization by given norm function i.e., it divides each element by the norm value computed from nfunc.
func FloatFunc ¶
func FloatFunc(tsr tensor.Tensor, nfunc32 Func32, nfunc64 Func64, stIdx, nIdx int, ffunc32 func(a []float32, fun Func32), ffunc64 func(a []float64, fun Func64))
FloatFunc applies given functions to float tensor data, which is either Float32 or Float64
func FloatOnlyError ¶
func FloatOnlyError() error
func MultVector32 ¶
MultVector32 multiplies vector elements by scalar
func SubNorm32 ¶
SubNorm32 does subtractive normalization by given norm function i.e., it subtracts norm computed by given function from each element.
func SubNorm64 ¶
SubNorm64 does subtractive normalization by given norm function i.e., it subtracts norm computed by given function from each element.
func TensorDivNorm ¶
TensorDivNorm does divisive normalization by given norm function computed on the first ndim dims of the tensor, where 0 = all values, 1 = norm each of the sub-dimensions under the first outer-most dimension etc. ndim must be < NumDims() if not 0.
func TensorSubNorm ¶
TensorSubNorm does subtractive normalization by given norm function computed on the first ndim dims of the tensor, where 0 = all values, 1 = norm each of the sub-dimensions under the first outer-most dimension etc. ndim must be < NumDims() if not 0 (panics).
func TensorUnit ¶
TensorUnit subtracts the min and divides by the max, so that values are in 0-1 unit range computed on the first ndim dims of the tensor, where 0 = all values, 1 = norm each of the sub-dimensions under the first outer-most dimension etc. ndim must be < NumDims() if not 0 (panics). must be a float32 or float64 tensor
func TensorZScore ¶
TensorZScore subtracts the mean and divides by the standard deviation computed on the first ndim dims of the tensor, where 0 = all values, 1 = norm each of the sub-dimensions under the first outer-most dimension etc. ndim must be < NumDims() if not 0 (panics). must be a float32 or float64 tensor
func Thresh32 ¶
Thresh32 thresholds the values of the vector -- anything above the high threshold is set to the high value, and everything below the low threshold is set to the low value.
func Thresh64 ¶
Thresh64 thresholds the values of the vector -- anything above the high threshold is set to the high value, and everything below the low threshold is set to the low value.
func Unit32 ¶
func Unit32(a []float32)
Unit32 subtracts the min and divides by the max, so that values are in 0-1 unit range
func Unit64 ¶
func Unit64(a []float64)
Unit64 subtracts the min and divides by the max, so that values are in 0-1 unit range