Versions in this module Expand all Collapse all v1 v1.0.0 Oct 3, 2024 Changes in this version + var ErrEmptyObservations error = fmt.Errorf("empty observation, there is no mean for an empty set of points") + var ErrKMustBeGreaterThanZero = fmt.Errorf("k must be greater than 0") + func AverageDistance[T Number](o Observation[T], observations iter.Seq[Observation[T]], degree int) float64 + func Center[T Number](os iter.Seq[Observation[T]], degree int) ([]T, error) + func Distance[T Number](o1, o2 Observation[T], degree int) float64 + func ObservationRange[T Number](oo iter.Seq[Observation[T]], degree int) (observationMins []T, observationMax []T) + func ObservationSum[T Number](oo iter.Seq[Observation[T]], degree int) (sum []T, count int) + type Cluster struct + Center Observation[T] + Observations *ObservationList[T] + func (c *Cluster[T]) Append(o Observation[T]) + func (c *Cluster[T]) MostCentral() Observation[T] + func (c *Cluster[T]) Recenter() + func (c *Cluster[T]) SumOfDistance() float64 + type Clusters []Cluster[T] + func New[T Number](k int, dataset Observations[T]) (Clusters[T], error) + func OptimizeClusters[T Number](k int, dataset Observations[T]) (Clusters[T], error) + func (c Clusters[T]) Largest() int + func (c Clusters[T]) Nearest(point Observation[T]) int + func (c Clusters[T]) Neighbor(point Observation[T], fromCluster int) (int, float64) + func (c Clusters[T]) Recenter() + func (c Clusters[T]) Reset() + func (c Clusters[T]) Smallest() int + func (c Clusters[T]) SumClusterVariance() float64 + type NormalizeObservationAdapter struct + func NewNormalizeObservationAdapter[T Number](oo Observations[T], scale []T) *NormalizeObservationAdapter[T] + func (n *NormalizeObservationAdapter[T]) Degree() int + func (n NormalizeObservationAdapter[T]) Denormalize(o Observation[T]) []T + func (n NormalizeObservationAdapter[T]) Normalize(ov Observation[T]) []T + func (n NormalizeObservationAdapter[T]) Observations() iter.Seq[Observation[T]] + type NormalizedObservation struct + Original *Observation[O] + func (o NormalizedObservation[T, O]) Values(i int) T + type Number interface + type Observation interface + Values func(i int) T + func SelectRandomObservations[T Number](oo Observations[T], k int) []Observation[T] + type ObservationList struct + ClusterObservations []Observation[T] + func NewObservationList[T Number](degree int) *ObservationList[T] + func (o *ObservationList[T]) All() iter.Seq[Observation[T]] + func (o *ObservationList[T]) Append(v Observation[T]) + func (o *ObservationList[T]) Degree() int + type Observations interface + Degree func() int + Observations func() iter.Seq[Observation[T]] + func NormalizeObservations[O Number](oo Observations[O]) Observations[float64]