Documentation
¶
Index ¶
- func LabelCount(Labels []int, K int) []int
- type KMeans
- func (kmeans *KMeans) AddPoint(point Point)
- func (kmeans *KMeans) AddPointList(Points []Point)
- func (kmeans *KMeans) CentroidsToString() string
- func (kmeans *KMeans) ComputeClosestCentroidIdx(point Point) int
- func (kmeans *KMeans) ComputeLabels() []int
- func (kmeans *KMeans) ComputeSSE() float64
- func (kmeans *KMeans) Fit(pointList []Point) bool
- func (kmeans *KMeans) GetPointIdxOfCentroid(centroidIdx int) []int
- func (kmeans *KMeans) InitCentroids() bool
- func (kmeans *KMeans) LabelCount() []int
- func (kmeans *KMeans) LabelsToString() string
- func (kmeans *KMeans) PointsToString() string
- type Point
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LabelCount ¶ added in v0.1.2
LabelCount - Returns the number of Points per centroid
Types ¶
type KMeans ¶
type KMeans struct {
//number of clusters
K int
//max number of iterations
MaxIter int
//Centroids of the clustering
Centroids []Point
//Points for clustering
Points []Point
//Labels of the corresponding point
Labels []int
}
KMeans - Struct for KMeans Algorithm
func (*KMeans) AddPoint ¶ added in v0.1.2
AddPoint - Add a new Point to the list and recalculate Centroids
func (*KMeans) AddPointList ¶ added in v0.1.2
AddPointList - Add a list of Points to the list and recalculate Centroids
func (*KMeans) CentroidsToString ¶ added in v0.1.2
CentroidsToString - returns the string of Centroids
func (*KMeans) ComputeClosestCentroidIdx ¶ added in v0.1.4
ComputeClosestCentroidIdx - returns the index of the closest centroid for that point
func (*KMeans) ComputeLabels ¶ added in v0.1.2
ComputeLabels - Computes Labels of the Points
func (*KMeans) ComputeSSE ¶ added in v0.1.2
ComputeSSE - computes Sum of Squared Erros
func (*KMeans) GetPointIdxOfCentroid ¶ added in v0.1.2
GetPointIdxOfCentroid - return indexes of Points of a certain centroid
func (*KMeans) InitCentroids ¶ added in v0.1.2
InitCentroids - Inits the Centroids for random
func (*KMeans) LabelCount ¶ added in v0.1.2
LabelCount - Returns the number of Points per centroid
func (*KMeans) LabelsToString ¶ added in v0.1.2
LabelsToString - Returns the string of Labels
func (*KMeans) PointsToString ¶ added in v0.1.2
PointsToString - Returns the String of the Points
type Point ¶
type Point []float64
Point - Slice of Float64 Values
func ComputeCentroids ¶ added in v0.1.2
ComputeCentroids - Recalculates Centroids position
func (Point) PointEqual ¶ added in v0.1.2
PointEqual - Checks if a point is equal to another