Documentation
¶
Index ¶
- type KMeansOption
- type MiniBatchKMeans
- func (kmeans *MiniBatchKMeans) ClusterCenters() [][]float64
- func (kmeans *MiniBatchKMeans) Fit(X, y mat.Matrix) error
- func (kmeans *MiniBatchKMeans) FitPredict(X, y mat.Matrix) (mat.Matrix, error)
- func (kmeans *MiniBatchKMeans) FitStream(ctx context.Context, dataChan <-chan *model.Batch) error
- func (kmeans *MiniBatchKMeans) Inertia() float64
- func (kmeans *MiniBatchKMeans) IsWarmStart() bool
- func (kmeans *MiniBatchKMeans) Labels() []int
- func (kmeans *MiniBatchKMeans) NIterations() int
- func (kmeans *MiniBatchKMeans) PartialFit(X, y mat.Matrix, classes []int) error
- func (kmeans *MiniBatchKMeans) Predict(X mat.Matrix) (mat.Matrix, error)
- func (kmeans *MiniBatchKMeans) PredictStream(ctx context.Context, inputChan <-chan mat.Matrix) <-chan mat.Matrix
- func (kmeans *MiniBatchKMeans) SetWarmStart(warmStart bool)
- func (kmeans *MiniBatchKMeans) Transform(X mat.Matrix) (mat.Matrix, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KMeansOption ¶
type KMeansOption func(*MiniBatchKMeans)
KMeansOption is a configuration option for MiniBatchKMeans
func WithKMeansBatchSize ¶
func WithKMeansBatchSize(batchSize int) KMeansOption
WithKMeansBatchSize sets the mini-batch size
func WithKMeansInit ¶
func WithKMeansInit(init string) KMeansOption
WithKMeansInit sets the initialization method
func WithKMeansMaxIter ¶
func WithKMeansMaxIter(maxIter int) KMeansOption
WithKMeansMaxIter sets the maximum number of iterations
func WithKMeansNClusters ¶
func WithKMeansNClusters(n int) KMeansOption
WithKMeansNClusters sets the number of clusters
func WithKMeansRandomState ¶
func WithKMeansRandomState(seed int64) KMeansOption
WithKMeansRandomState sets the random seed
func WithKMeansTol ¶
func WithKMeansTol(tol float64) KMeansOption
WithKMeansTol sets the tolerance for convergence
type MiniBatchKMeans ¶
type MiniBatchKMeans struct {
// contains filtered or unexported fields
}
MiniBatchKMeans implements mini-batch K-means clustering Compatible with scikit-learn's MiniBatchKMeans
func NewMiniBatchKMeans ¶
func NewMiniBatchKMeans(options ...KMeansOption) *MiniBatchKMeans
NewMiniBatchKMeans creates a new MiniBatchKMeans instance
func (*MiniBatchKMeans) ClusterCenters ¶
func (kmeans *MiniBatchKMeans) ClusterCenters() [][]float64
ClusterCenters returns the learned cluster centers
func (*MiniBatchKMeans) Fit ¶
func (kmeans *MiniBatchKMeans) Fit(X, y mat.Matrix) error
Fit trains the model using batch learning
func (*MiniBatchKMeans) FitPredict ¶
FitPredict performs training and prediction simultaneously
func (*MiniBatchKMeans) Inertia ¶
func (kmeans *MiniBatchKMeans) Inertia() float64
Inertia returns inertia (within-cluster sum of squared errors)
func (*MiniBatchKMeans) IsWarmStart ¶
func (kmeans *MiniBatchKMeans) IsWarmStart() bool
IsWarmStart returns whether warm start is enabled (always false)
func (*MiniBatchKMeans) Labels ¶
func (kmeans *MiniBatchKMeans) Labels() []int
Labels returns cluster labels for training data
func (*MiniBatchKMeans) NIterations ¶
func (kmeans *MiniBatchKMeans) NIterations() int
NIterations returns the number of training iterations performed
func (*MiniBatchKMeans) PartialFit ¶
func (kmeans *MiniBatchKMeans) PartialFit(X, y mat.Matrix, classes []int) error
PartialFit trains the model incrementally with mini-batches
func (*MiniBatchKMeans) PredictStream ¶
func (kmeans *MiniBatchKMeans) PredictStream(ctx context.Context, inputChan <-chan mat.Matrix) <-chan mat.Matrix
PredictStream performs real-time prediction on input stream
func (*MiniBatchKMeans) SetWarmStart ¶
func (kmeans *MiniBatchKMeans) SetWarmStart(warmStart bool)
SetWarmStart sets warm start enable/disable (does nothing)