Updated Instances (markdown)

Richard Townsend 2014-07-26 05:29:30 -07:00
parent 59926a5d05
commit e9fd7770bd
1 changed files with 16 additions and 0 deletions

@ -1,5 +1,21 @@
Golearn's model for machine learning problems will be familiar if you've used SciPy, WEKA or R. Data is represented as a flat table, analogous to a spreadsheet, and used for training and prediction. The structure which implements this table is called `Instances`.
Sorting Instances
-----------------
`Sort` implements an in-place radix sort. It accepts a sort direction (Ascending or Descending) and a slice of integer Attribute positions.
**Code excerpt: sorting instances**
````go
inst, _ := base.ParseCSVToInstances
attrs := make([]int, 4)
attrs[0] = 3
attrs[1] = 2
attrs[2] = 1
attrs[3] = 0
inst.Sort(Descending, attrs)
````
Because radix sort isn't stable (maintaining the original order of sorted elements is not guaranteed), sort by all of the Attributes available to get a consistent result.
Sample application
------------------