Documentation
¶
Overview ¶
DBSCAN (Density-based spatial clustering) clustering optimized for multicore processing.
Usage example:
var clusterer = NewDBSCANClusterer( 2.0, 2 )
var data = []ClusterablePoint{
&NamedPoint{"0", []float64{2, 4}},
&NamedPoint{"1", []float64{7, 3}},
&NamedPoint{"2", []float64{3, 5}},
&NamedPoint{"3", []float64{5, 3}},
&NamedPoint{"4", []float64{7, 4}},
}
clusterer.MinPts = 2
clusterer.SetEps( 2.0 )
// Automatic discovery of dimension with max variance
clusterer.AutoSelectDimension = false
// Set dimension manually
clusterer.SortDimensionIndex = 1
var result [][]ClusterablePoint = clusterer.Cluster(data)
Index ¶
- func Variance(data []ClusterablePoint, dimension int) float64
- type ClusterablePoint
- type ClusterablePointSlice
- type Clusterer
- type ConcurrentQueue_InsertOnly
- type DBSCANClusterer
- func (this *DBSCANClusterer) BuildNeighborhoodMap(data []ClusterablePoint) []*ConcurrentQueue_InsertOnly
- func (this *DBSCANClusterer) CalcDistance(aPoint, bPoint []float64) float64
- func (this *DBSCANClusterer) Cluster(data []ClusterablePoint) [][]ClusterablePoint
- func (this *DBSCANClusterer) GetEps() float64
- func (this *DBSCANClusterer) PredictDimensionByMaxVariance(data []ClusterablePoint) int
- func (this *DBSCANClusterer) SetEps(eps float64)
- type NamedPoint
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Variance ¶
func Variance(data []ClusterablePoint, dimension int) float64
Types ¶
type ClusterablePoint ¶
func NamedPointToClusterablePoint ¶
func NamedPointToClusterablePoint(in []*NamedPoint) (out []ClusterablePoint)
type ClusterablePointSlice ¶
type ClusterablePointSlice struct {
Data []ClusterablePoint
SortDimension int
}
Slice attaches the methods of Interface to []float64, sorting in increasing order.
func (ClusterablePointSlice) Len ¶
func (self ClusterablePointSlice) Len() int
func (ClusterablePointSlice) Less ¶
func (self ClusterablePointSlice) Less(i, j int) bool
func (ClusterablePointSlice) Sort ¶
func (self ClusterablePointSlice) Sort()
Sort is a convenience method.
func (ClusterablePointSlice) Swap ¶
func (self ClusterablePointSlice) Swap(i, j int)
type Clusterer ¶
type Clusterer interface {
Cluster([]ClusterablePoint) [][]ClusterablePoint
}
type ConcurrentQueue_InsertOnly ¶
func NewConcurrentQueue_InsertOnly ¶
func NewConcurrentQueue_InsertOnly() *ConcurrentQueue_InsertOnly
func (*ConcurrentQueue_InsertOnly) Add ¶
func (self *ConcurrentQueue_InsertOnly) Add(value uint)
func (*ConcurrentQueue_InsertOnly) Slice ¶
func (self *ConcurrentQueue_InsertOnly) Slice() []uint
type DBSCANClusterer ¶
type DBSCANClusterer struct {
MinPts, SortDimensionIndex int
AutoSelectDimension bool
// contains filtered or unexported fields
}
func NewDBSCANClusterer ¶
func NewDBSCANClusterer(eps float64, minPts int) *DBSCANClusterer
func (*DBSCANClusterer) BuildNeighborhoodMap ¶
func (this *DBSCANClusterer) BuildNeighborhoodMap(data []ClusterablePoint) []*ConcurrentQueue_InsertOnly
func (*DBSCANClusterer) CalcDistance ¶
func (this *DBSCANClusterer) CalcDistance(aPoint, bPoint []float64) float64
func (*DBSCANClusterer) Cluster ¶
func (this *DBSCANClusterer) Cluster(data []ClusterablePoint) [][]ClusterablePoint
* step 1: sort data by a dimension step 2: slide through sorted data (in parallel), and compute all points in range of eps (everything above eps is definitely isn't directly reachable) step 3: build neighborhood map & proceed DFS *
func (*DBSCANClusterer) GetEps ¶
func (this *DBSCANClusterer) GetEps() float64
func (*DBSCANClusterer) PredictDimensionByMaxVariance ¶
func (this *DBSCANClusterer) PredictDimensionByMaxVariance(data []ClusterablePoint) int
*
- Calculate variance for each dimension (in parallel), returns dimension index with max variance
func (*DBSCANClusterer) SetEps ¶
func (this *DBSCANClusterer) SetEps(eps float64)
type NamedPoint ¶
func NewNamedPoint ¶
func NewNamedPoint(name string, point []float64) *NamedPoint
func (*NamedPoint) Copy ¶
func (self *NamedPoint) Copy() *NamedPoint
func (*NamedPoint) GetPoint ¶
func (self *NamedPoint) GetPoint() []float64
func (*NamedPoint) String ¶
func (self *NamedPoint) String() string
Click to show internal directories.
Click to hide internal directories.