kmeans

package module
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2019 License: GPL-3.0 Imports: 9 Imported by: 2

README

KMeans-Go

Implementation of KMeans Clustering in Golang.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LabelCount added in v0.1.2

func LabelCount(labels []int, k int) []int

LabelCount - Returns the number of points per centroid

Types

type KMeans

type KMeans struct {
	// contains filtered or unexported fields
}

KMeans - Struct for KMeans Algorithm

func (*KMeans) AddPoint added in v0.1.2

func (kmeans *KMeans) AddPoint(point Point)

AddPoint - Add a new Point to the list and recalculate centroids

func (*KMeans) AddPointList added in v0.1.2

func (kmeans *KMeans) AddPointList(points []Point)

AddPointList - Add a list of Points to the list and recalculate centroids

func (*KMeans) CentroidsToString added in v0.1.2

func (kmeans *KMeans) CentroidsToString() string

CentroidsToString - returns the string of centroids

func (*KMeans) ComputeLabels added in v0.1.2

func (kmeans *KMeans) ComputeLabels() []int

ComputeLabels - Computes labels of the points

func (*KMeans) ComputeSSE added in v0.1.2

func (kmeans *KMeans) ComputeSSE() float64

ComputeSSE - computes Sum of Squared Erros

func (*KMeans) Fit added in v0.1.2

func (kmeans *KMeans) Fit(pointList []Point) bool

Fit - Fits the points into k centroids

func (*KMeans) GetPointIdxOfCentroid added in v0.1.2

func (kmeans *KMeans) GetPointIdxOfCentroid(centroidIdx int) []int

GetPointIdxOfCentroid - return indexes of points of a certain centroid

func (*KMeans) InitCentroids added in v0.1.2

func (kmeans *KMeans) InitCentroids() bool

InitCentroids - Inits the Centroids for random

func (*KMeans) LabelCount added in v0.1.2

func (kmeans *KMeans) LabelCount() []int

LabelCount - Returns the number of points per centroid

func (*KMeans) LabelsToString added in v0.1.2

func (kmeans *KMeans) LabelsToString() string

LabelsToString - Returns the string of Labels

func (*KMeans) PointsToString added in v0.1.2

func (kmeans *KMeans) PointsToString() string

PointsToString - Returns the String of the Points

type Point

type Point []float64

Point - Slice of Float64 Values

func ComputeCentroids added in v0.1.2

func ComputeCentroids(pointList []Point, distIndex []int, k int) []Point

ComputeCentroids - Recalculates centroids position

func (Point) Norm added in v0.1.2

func (point Point) Norm() float64

Norm - returns the point norm

func (Point) PointDist added in v0.1.2

func (point Point) PointDist(p2 Point) float64

PointDist - returns the distance between to Points

func (Point) PointEqual added in v0.1.2

func (point Point) PointEqual(p2 Point) bool

PointEqual - Checks if a point is equal to another

func (Point) Print added in v0.1.2

func (point Point) Print()

Print - Prints the point vaues

func (Point) Subtract added in v0.1.2

func (point Point) Subtract(p2 Point) Point

Subtract - returns the value by value subtraction of two points

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL