HomeForumSourceResearchGuide
Sign in to contribute to source. how it works
Type definition file ml.cluster.Clustering by barry
expand copy to clipboardexpand
/* {"description" : "Data type to represent a cluster point, with an associated data instance and list of values."} */
data ClusterPoint {
	Data element
	dec values[]
	}

/* {"description" : "Data type to represent a cluster, with a list of points, and a mean value."} */
data Cluster {
	ClusterPoint members[]
	dec mean[]
	}

/* {"description" : "A clustering algorithm."} */
interface Clustering {
	
	/* {"@description" : "Initialise clustering algorithm for a coordinate space of the given dimensionality",
		"dimensions" : "The number of dimensions of the coordinate space that you will use for clustering (e.g. 2 for an x/y space)"} */
	Clustering(int dimensions)
	
	/* {"@description" : "Add a value to the set from which clusters will be formed",
		"values" : "The numeric values of this coordinate, which must be of length 'dimensions'",
		"el" : "A data element to associate with this value"} */
	void addValue(dec values[], store Data el)
	
	/* {"@description" : "Run the clustering algorithm on the accumulated values",
		"k" : "The number of clusters to create",
		"@return" : "The set of clusters"} */
	Cluster[] cluster(int k)
	}
Revision history
To propose a new revision to this entity, use dana source put -ut your/new/version.dn -n ml.cluster.Clustering -m "reason for update" -u yourUsername
Version 3 by barry
Version 2 (this version) by barry
Notes for this version: Updates documentation strings.
Version 1 by barry