Documentation ¶
Overview ¶
Package set defines interfaces for sets as samples.
It also provides some basic implementations for them.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Sample ¶
Sample represents an item to process or from which to learn how to process them.
Its ValueFor method returns the value of the sample corresponding to the feature passed as parameter.
type Set ¶
type Set interface { Entropy(context.Context, feature.Feature) (float64, error) SubsetWith(context.Context, feature.Criterion) (Set, error) FeatureValues(context.Context, feature.Feature) ([]interface{}, error) CountFeatureValues(context.Context, feature.Feature) (map[string]int, error) Samples(context.Context) ([]Sample, error) Count(context.Context) (int, error) }
Set represents a collection of samples.
Its Entropy method returns the entropy of the set for a given Feature: a measure of the disinformation we have on the classes of samples that belong to it.
Its Classes method returns the set of uniq classes of samples belonging to the set.
Its SubsetWith method takes a feature.Criterion and returns a subset that only contains samples that satisfy it.
Its Samples method returns the samples it contains
func New ¶
New takes a slice of samples and returns a set built with them. The set will be a CPU intensive one when the number of samples is over sampleCountThresholdForSetImplementation
func NewCPUIntensive ¶
NewCPUIntensive takes a slice of samples and returns a Set built with them. A cpu-intensive set is an implementation that instead of replicating the samples when subsetting, stores the applying feature criteria to define the subset and keeps the same sample slice. This can achieve a drastic reduction in memory use that comes at the cost of CPU time: every calculation that goes over the samples of the set will apply the feature criteria of the set on all original samples (the ones provided to this method).
func NewMemoryIntensive ¶
NewMemoryIntensive takes a slice of samples and returns a Set built with them. A memory-intensive set is an implementation that replicates the slice of samples when subsetting to reduce calculations at the cost of increased memory.
Directories ¶
Path | Synopsis |
---|---|
Package csv provides functions to read/write a set.Set as CSV
|
Package csv provides functions to read/write a set.Set as CSV |
Package inputsample provides an implementation of set.Sample that is read from an io.Reader.
|
Package inputsample provides an implementation of set.Sample that is read from an io.Reader. |
Package sqlset provides implementations of set.Set that use SQL database as backends.
|
Package sqlset provides implementations of set.Set that use SQL database as backends. |
pgadapter
Package pgadapter provides an implementation of the Adapter interface in the sqlset package that works over a PostgreSQL database.
|
Package pgadapter provides an implementation of the Adapter interface in the sqlset package that works over a PostgreSQL database. |
sqlite3adapter
Package sqlite3adapter provides an implementation of the Adapter interface in the sqlset package that works over a SQLite3 database.
|
Package sqlite3adapter provides an implementation of the Adapter interface in the sqlset package that works over a SQLite3 database. |