Documentation ¶
Overview ¶
Package utils contains subpackages for independence tests (e.g. Chi-Square) and clustering (e.g. K-Means), and also contains VarData, String Concat and Union-Find.
Index ¶
- Variables
- func AntiLog(l float64) float64
- func Inf(sig int) float64
- func Log(p float64) float64
- func LogProd(p []float64) float64
- func LogSum(p []float64) float64
- func LogSumExp(a []float64) float64
- func LogSumExpPair(l, r float64) float64
- func LogSumLog(v []float64, s []int) (float64, int)
- func LogSumPair(p1, p2 float64) float64
- func Mean(c []int) float64
- func MuSigma(c []int) (float64, float64)
- func PartitionQuantiles(X []int, m int) [][]float64
- func StdDev(c []int) float64
- func StringConcat(s1, s2 string) string
- func Trim(a []float64, c float64) []float64
- func UFVarids(x *UFNode) []int
- type UFNode
- type VarData
Constants ¶
This section is empty.
Variables ¶
var ( // LogZero = ln(0) = -inf LogZero float64 EpsZero float64 )
Functions ¶
func AntiLog ¶
AntiLog is the antilog with base e of l. It is equivalent to e raised to the power of l. Thus the following identities apply
antiln(ln(k)) = k ln(antiln(k)) = k
Returns a float64 that corresponds to the antilog of l.
func LogProd ¶
LogProd is the log of the product of probabilities given by
prod_i p_i -> sum_i ln(p_i)
Returns a float64 with the resulting log operation. To convert back use utils.AntiLog.
func LogSum ¶
LogSum is the log of the sum of probabilities given by
sum_i p_i -> P + ln(sum_i e^(ln(p_i) - P)), where P = max_i ln(p_i)
Returns a float64 with the resulting log operation. To convert back use utils.AntiLog.
func LogSumExp ¶
LogSumExp takes a slice of floats a={a_1,...,a_n} and computes ln(exp(a_1)+...+exp(a_n)).
func LogSumExpPair ¶
LogSumExpPair takes two floats l and r and computes ln(l+r). Particular case of LogSumExp.
func PartitionQuantiles ¶
PartitionQuantiles takes a slice of values X of a single variable from the dataset and the number m of quantiles to partition the data. Returns a slice of pair of values containing mean and standard deviation (in this order).
Types ¶
type UFNode ¶
type UFNode struct { // Pa is Parent of UFNode. Since we use the Path-compression heuristic, this is usually the // representative of the set (i.e. the root node). Pa *UFNode // Children. Ch []*UFNode // contains filtered or unexported fields }
UFNode is a Union-Find node on a Union-Find tree. Holds an integer as value. In this case we wish to store the variable ID.
type VarData ¶
type VarData struct { // Variable ID. Varid int // Number of possible instantiations (levels/categories) of Varid. Categories int // Observed data. Data []int }
VarData is a wrapper struct that contains a variable ID and its observed data. Observed data is data that is to be used in learning. Each data instance i in data (i.e. data[i]) is a variable instantiation.
func NewVarData ¶
NewVarData constructs a new VarData. Equivalent to &VarData{varid, categories, data}.
Directories ¶
Path | Synopsis |
---|---|
Package cluster contains clustering algorithms.
|
Package cluster contains clustering algorithms. |
metrics
Package metrics contains distance metrics (e.g.
|
Package metrics contains distance metrics (e.g. |
Package indep contains independence test algorithms (e.g.
|
Package indep contains independence test algorithms (e.g. |