clustering

package
v0.0.0-...-60ce4f0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

This package implements clustering algorithms

Index

Constants

This section is empty.

Variables

View Source
var (
	NoTrainingDataError         = errors.New("You need to Fit() before you can Predict()")
	InsufficientComponentsError = errors.New("Estimation requires at least one component")
	InsufficientDataError       = errors.New("Estimation requires n_obs >= n_comps")
)

Functions

func BitCount

func BitCount(n *big.Int) int

How many bits?

Types

type ClusterMap

type ClusterMap map[int][]int

ClusterMap contains the cluster identifier as a key, followed by a vector of point indices that cluster contains.

func DBSCAN

func DBSCAN(inst base.FixedDataGrid, params DBSCANParameters) (ClusterMap, error)

DBSCAN clusters inst using the parameters allowed in and produces a ClusterId->[RowId] map

func (ClusterMap) Equals

func (ref ClusterMap) Equals(other ClusterMap) (bool, error)

Equals checks whether a bijection exists between two ClusterMaps (i.e. the clusters in one can be re-labelled to become the clusters of another)

func (ClusterMap) Invert

func (ref ClusterMap) Invert() (map[int]int, error)

Invert returns an alternative form of cluster map where the key represents the point index and the value represents the cluster index it's assigned to

type ClusterParameters

type ClusterParameters struct {
	// Attributes represents the set of Attributes which
	// can be used for clustering
	Attributes []base.Attribute

	// Metric is used to compute pairwise distance
	Metric pairwise.PairwiseDistanceFunc
}

type DBSCANParameters

type DBSCANParameters struct {
	ClusterParameters

	// Eps represents the "reachability", or the maximum
	// distance any point can be before being considered for
	// inclusion.
	Eps float64

	// MinCount represents how many points need to be
	// in a cluster before it is considered one.
	MinCount int
}

DBSCANParameters describes the parameters of the density-based clustering algorithm DBSCAN

type ExpectationMaximization

type ExpectationMaximization struct {
	Params Params
	// contains filtered or unexported fields
}

func NewExpectationMaximization

func NewExpectationMaximization(n_comps int) (*ExpectationMaximization, error)

Number of Gaussians to fit in the mixture

func (*ExpectationMaximization) Fit

Fit method - generates the component parameters (means and covariance matrices)

func (*ExpectationMaximization) Predict

Predict method - returns a ClusterMap of components and row ids

type Params

type Params struct {
	Means *mat.Dense
	Covs  []mat.Symmetric
}

Jump to

Keyboard shortcuts

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