clusters

package
v0.2.0-mixed Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2021 License: LGPL-2.1 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AverageDistance

func AverageDistance(point space.Point, points PointList) float64

AverageDistance returns the average distance between o and all PointList

Types

type Cluster

type Cluster struct {
	C      int   //dbscan
	Points []int //dbscan

	Center    space.Point
	PointList PointList
}

A Cluster which data points gravitate around

func (*Cluster) Append

func (c *Cluster) Append(point space.Point)

Append adds an observation to the Cluster

func (Cluster) PointsInDimension

func (c Cluster) PointsInDimension(n int) (v []float64)

PointsInDimension returns all coordinates in a given dimension

func (*Cluster) Recenter

func (c *Cluster) Recenter()

Recenter recenters a cluster

type Clusters

type Clusters []Cluster

Clusters is a slice of clusters

func New

func New(k int, dataset PointList) (Clusters, error)

New sets up a new set of clusters and randomly seeds their initial positions

func (Clusters) CentersInDimension

func (c Clusters) CentersInDimension(n int) (v []float64)

CentersInDimension returns all cluster centroids' coordinates in a given dimension

func (Clusters) Nearest

func (c Clusters) Nearest(point space.Point) int

Nearest returns the index of the cluster nearest to point

func (Clusters) Neighbour

func (c Clusters) Neighbour(point space.Point, fromCluster int) (int, float64)

Neighbour returns the neighbouring cluster of a point along with the average distance to its points

func (Clusters) Recenter

func (c Clusters) Recenter()

Recenter recenters all clusters

func (Clusters) Reset

func (c Clusters) Reset()

Reset clears all point assignments

type PointList

type PointList []space.Point

PointList is a slice of Point

func (PointList) Center

func (points PointList) Center() (p space.Point, err error)

Center returns the center coordinates of a set of Points

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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