Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AverageEntropy ¶
AverageEntropy returns the average entropy of the class column over each distinct value of the attribute column.
func Entropy ¶
Entropy returns the Shannon entropy for the given probability. It converts the edge cases of probability zero and one to a zero entropy value.
func TotalEntropy ¶
TotalEntropy returns the total entropy of the class column in the view.
Types ¶
type Case ¶
type Case struct {
Value string // The distinct column value.
Class string // The decided class value, or "" if further decision(s) are needed.
Decide *Decision // The subsequent decision, or nil.
}
A Case is a distinct value and its associated action; either a decided class value or a subsequent decision.
type Decision ¶
type Decision struct {
Column string // The name of the data column.
Cases []*Case // The cases for that column.
}
Decision represents a decision within the decision tree for a single column. Each distinct value in that column is a case. The cases are in decreasing probability sequence.
type Distinct ¶
Distinct is a distinct column value and its associated probability.
func Likelihood ¶
Likelihood returns the probability of each distinct value in the named column of the view. The slice is sorted in decreasing probability.
type View ¶
type View interface {
// Columns returns the column names in this view. Columns with names of ""
// have been hidden from this view - see Drop method.
//
Columns() []string
// First returns to before the first row in this view.
//
First()
// Next returns the next row in the view, or nil if there are no more
// rows.
//
Next() []string
// Select returns a view that shows only rows having the given value in the
// column.
//
Select(column, value string) View
// Drop returns a view which 'hides' the named column.
//
Drop(column string) View
}
View is the interface for ID3 to inspect CSV conformant data. It provides a cursor like mechanism for reading the data, through the First() and Next() functions.