Documentation
¶
Index ¶
- Constants
- Variables
- type KMeans
- func (km *KMeans) Centroids() [][]float32
- func (km *KMeans) Decode(dec *gob.Decoder) error
- func (km *KMeans) Encode(enc *gob.Encoder) error
- func (km *KMeans) Predict(data []float32, fn func(row, minCol int, minVal float32) error) error
- func (km *KMeans) Train(data []float32, opts ...TrainOption) (int, float32, error)
- type KMeansState
- type NewOption
- type TrainOption
Constants ¶
View Source
const ( INIT_NONE = iota INIT_KMEANS_PLUS_PLUS INIT_RANDOM )
Variables ¶
View Source
var ( ErrInvalidInitMethod = errors.New("invalid init method") ErrInvalidDataLength = errors.New("data length must be divisible by the number of features") ErrInvalidNumClusters = errors.New("number of clusters must be greater than 0") ErrInvalidNumFeatures = errors.New("number of features must be greater than 0") ErrEmptyData = errors.New("data is empty") ErrFewerClustersThanData = errors.New("number of clusters must be less than the number of data points") ErrInvalidMaxIterations = errors.New("max iterations must be greater than 0") ErrInvalidTolerance = errors.New("tolerance must be greater than 0") ErrInvalidConcurrency = errors.New("concurrency must be greater than 0") )
Functions ¶
This section is empty.
Types ¶
type KMeans ¶
type KMeans struct {
// contains filtered or unexported fields
}
type KMeansState ¶ added in v0.0.3
type NewOption ¶ added in v0.0.3
type NewOption func(*KMeansState) error
func WithInitMethod ¶ added in v0.0.3
type TrainOption ¶ added in v0.0.3
type TrainOption func(*trainConfig) error
func WithConcurrency ¶ added in v0.0.3
func WithConcurrency(concurrency int) TrainOption
func WithMaxIterations ¶ added in v0.0.3
func WithMaxIterations(iter int) TrainOption
func WithTolerance ¶ added in v0.0.3
func WithTolerance(tol float32) TrainOption
Click to show internal directories.
Click to hide internal directories.