Documentation ¶
Overview ¶
Package kmeans provides k-means based implementation of online clustering
Index ¶
- Variables
- func CreateInitializer(name string) core.Initializer
- func GivenInitializer(k int, elemts []core.Elemt, space core.Space, _ *rand.Rand) (centroids core.Clust, err error)
- func NewAlgo(conf Conf, space core.Space, data []core.Elemt, initializer core.Initializer, ...) *core.Algo
- func PPInitializer(k int, elemts []core.Elemt, space core.Space, src *rand.Rand) (centroids core.Clust, err error)
- func PPIter(clust core.Clust, elemts []core.Elemt, space core.Space, src *rand.Rand) (core.Elemt, error)
- func RandInitializer(k int, elemts []core.Elemt, space core.Space, src *rand.Rand) (centroids core.Clust, err error)
- func WeightedChoice(weights []float64, rand *rand.Rand) (int, error)
- type Conf
- type Impl
- func (impl *Impl) Copy(model core.OCModel) (core.Impl, error)
- func (impl *Impl) Init(model core.OCModel) (clust core.Clust, err error)
- func (impl *Impl) Iterate(model core.OCModel) (clust core.Clust, runtimeFigures core.RuntimeFigures, err error)
- func (impl *Impl) Push(elemt core.Elemt, model core.OCModel) error
- type ParStrategy
- type SeqStrategy
- type Strategy
Constants ¶
This section is empty.
Variables ¶
var ErrNullSet = errors.New("cannot draw over an empty set")
ErrNullSet indicates that a draw over an empty set was attempted
Functions ¶
func CreateInitializer ¶
func CreateInitializer(name string) core.Initializer
CreateInitializer creates an initializer with a name
func GivenInitializer ¶
func GivenInitializer(k int, elemts []core.Elemt, space core.Space, _ *rand.Rand) (centroids core.Clust, err error)
GivenInitializer initializes a clustering algorithm with the k first testPoints.
func NewAlgo ¶
func NewAlgo(conf Conf, space core.Space, data []core.Elemt, initializer core.Initializer, args ...interface{}) *core.Algo
NewAlgo creates a new kmeans algo
func PPInitializer ¶
func PPInitializer(k int, elemts []core.Elemt, space core.Space, src *rand.Rand) (centroids core.Clust, err error)
PPInitializer initializes a clustering algorithm with kmeans++
func PPIter ¶
func PPIter(clust core.Clust, elemts []core.Elemt, space core.Space, src *rand.Rand) (core.Elemt, error)
PPIter runs a kmeans++ iteration : draw an element the does not belong to clust
Types ¶
type Conf ¶
type Conf struct { core.CtrlConf Par bool K int FrameSize int RGen *rand.Rand NumCPU int // maximal number of CPU to use }
Conf of KMeans
func (*Conf) SetDefaultValues ¶ added in v0.2.0
func (conf *Conf) SetDefaultValues()
SetDefaultValues initializes nil configuration values
type Impl ¶
type Impl struct {
// contains filtered or unexported fields
}
Impl algorithm abstract implementation
func NewParImpl ¶
func NewParImpl(conf Conf, initializer core.Initializer, data []core.Elemt, args ...interface{}) (impl Impl)
NewParImpl parallelizes algorithm implementation
func NewSeqImpl ¶
func NewSeqImpl(conf Conf, initializer core.Initializer, data []core.Elemt, args ...interface{}) Impl
NewSeqImpl returns a sequential algorithm execution
type ParStrategy ¶
type ParStrategy struct {
Degree int
}
ParStrategy parallelizes algorithm strategy
type SeqStrategy ¶
type SeqStrategy struct { }
SeqStrategy defines strategy for sequential execution