%DeepSee.extensions.clusters.AbstractModel
class %DeepSee.extensions.clusters.AbstractModel extends %Library.RegisteredObject
This class provides a base class for implementation for different Cluster Analysis algorithms. It defines storage for clustering models and provides methods to retrieve information about data and clustering.Cluster analysis or clustering is the assignment of a set of observations into subsets (called clusters) so that observations in the same cluster are similar in some sense. Clustering is a method of unsupervised learning, and a common technique for statistical data analysis used in many fields, including machine learning, data mining, pattern recognition, image analysis, information retrieval, and bioinformatics.
By Default model data is stored in ^CacheTemp globals.
Property Inventory
Method Inventory
- ById()
- Delete()
- Distance()
- Distance1()
- Distance12()
- Exists()
- GeneratePMML()
- GetASWIndex()
- GetCalinskiHarabaszIndex()
- GetCentroid()
- GetCluster()
- GetClusterSize()
- GetCost()
- GetCount()
- GetData()
- GetDimensions()
- GetId()
- GetNumberOfClusters()
- GetPearsonGammaIndex()
- GlobalCentroid()
- IsPrepared()
- RelativeClusterCost()
- Reset()
- SetData()
- SubsetCentroid()
- iterateCluster()
- printAll()
- printCluster()
- randomSubset()
Properties
property DSName as %String;
Property methods: DSNameDisplayToLogical(), DSNameGet(), DSNameIsValid(), DSNameLogicalToDisplay(), DSNameLogicalToOdbc(), DSNameNormalize(), DSNameSet()
property Dim as %Integer;
Property methods: DimDisplayToLogical(), DimGet(), DimIsValid(), DimLogicalToDisplay(), DimNormalize(), DimSet()
property Normalize as %Boolean [ InitialExpression = 1 ];
Whether to normalize distance across multiple dimensions. If set to 1 (default) then
distance is normalized by variances.
Property methods: NormalizeDisplayToLogical(), NormalizeGet(), NormalizeIsValid(), NormalizeLogicalToDisplay(), NormalizeNormalize(), NormalizeSet()
property P as %Double [ InitialExpression = 2 ];
The power to use in calculation of dissimilarity. Default is Euclidean distance (P=2).
Specify 1 for Manhattan Distance or 100 for Chebyshev distance (max between coordinates).
Property methods: PDisplayToLogical(), PGet(), PIsValid(), PLogicalToDisplay(), PNormalize(), POdbcToLogical(), PSet()
property Verbose as %Boolean [ InitialExpression = 1 ];
Property methods: VerboseDisplayToLogical(), VerboseGet(), VerboseIsValid(), VerboseLogicalToDisplay(), VerboseNormalize(), VerboseSet()
Methods
method ById(id As %CacheString) as %Integer
Returns the ordinal number of the point with the given ID id.
The unique id must correspond to the one assigned in SetData()() method
Deletes a model for a dataset with the name given by dataset argument.
method Distance(i As %Integer, j As %Integer, p As %Double = 2, normalize As %Boolean = 1) as %Double
Returns the dissimilarity measure between two data points of the model. The method takes 4 arguments:
- i, j - Ordinal number of the data points in the model
- p - Optional, if specified the power for a Minkowski distance. Default is Euclidean distance (p=2). Specify 1 for Manhattan Distance or 100 for Chebyshev distance (max between coordinates).
- normalize - whether to normalize coordinates by their variances
Returns the dissimilarity measure between a data points of the model and a point with given coordinates.
The method takes 4 arguments:
- i - The ordinal number of the data point in the model
- z - The multidimensional coordinates of the second point: z(1), z(2), ..., z(dim)
- p - Optional, if specified the power for a Minkowski distance. Default is Euclidean distance (p=2). Specify 1 for Manhattan Distance or 100 for Chebyshev distance (max between coordinates).
- normalize - whether to normalize coordinates by their variances
Returns the dissimilarity measure between two points with given coordinates.
The method takes 4 arguments:
- z1, z2 - The multidimensional coordinates of the points: z1(1), z1(2), ..., z1(dim)
- p - Optional, if specified the power for a Minkowski distance. Default is Euclidean distance (p=2). Specify 1 for Manhattan Distance or 100 for Chebyshev distance (max between coordinates).
- normalize - whether to normalize coordinates by their variances
Checks whether a model for a dataset with the name given by dataset argument already exists.
method GeneratePMML(Output pPMML As %DeepSee.PMML.Definition.PMML, ByRef pClusterNames) as %Status
method GetASWIndex() as ASW
Returns an object that can calculate an index used in Cluster Validation
and determining the optimal number of clusters.
This method returns Average Silhouette Width index.
method GetCalinskiHarabaszIndex(normalize As %Integer = -1) as CalinskiHarabasz
Returns an object that can calculate an index used in Cluster Validation
and determining the optimal number of clusters. This method returns Calinski-Harabasz index.
method GetCentroid(k As %Integer, Output z)
Returns the coordinates for the centroid for a given cluster.
Cluster is identified by its ordinal number k.
Coordinates are returned as multidimensional value: z(1), z(2), ..., z(dim)
Coordinates are returned as multidimensional value: z(1), z(2), ..., z(dim)
Returns the cluster ordinal for a given point. Point is identified by its ordinal number.
method GetClusterSize(k As %Integer)
Returns the number of data points assigned to a given cluster.
Cluster is identified by its ordinal number k.
Returns the dissimilarity measure as used by this clustering algorithm
between two data points of the model. Points are identified by their ordinal numbers.
method GetCount() as %Integer
Returns the number of all data points in the model.
method GetDimensions() as %Integer
Returns the dimensionality of the model.
Returns the unque Id of the point with the ordinal number specified by i.
The unique Id is as has been assigned in SetData()() method
method GetNumberOfClusters() as %Integer
Returns the number of clusters in the model.
method GetPearsonGammaIndex() as PearsonGamma
Returns an object that can calculate an index used in Cluster Validation
and determining the optimal number of clusters.
This method returns Pearson-Gamma index which is a correlation coefficient
between distance between two points and a binary function whether they
belong to the same cluster. This index is useful when clustering is used
for dimension reduction i.e. the process of reducing the number of
random variables under consideration
method GlobalCentroid(Output z)
Returns the coordinates for the centroid for the whole dataset.
Coordinates are returned as multidimensional value: z(1), z(2), ..., z(dim)
Coordinates are returned as multidimensional value: z(1), z(2), ..., z(dim)
method IsPrepared() as %Boolean
Checks whether the model is ready for an analysis to be executed. This is dependent on a
specific algorithm and therefore this method is overriden by subclasses.
Returns the realtive cost of a given cluster relative to a medoid point m.
Cluster is identified by its ordinal number k.
Point m is identified by its ordinal number.
method Reset()
Kills all the data associated with this model.
method SetData(rs As %IResultSet, dim As %Integer, nullReplacement As %Double = -1) as %Status
Sets the data to be associated with this model. The method takes 3 arguments:
- rs - is a result set that provides the data. The first column returned by the result set is assumed to be a unique Id of teh record. It is not used in any clustering algorithms but can be retrieved by the application to identify the record. It can be a database %ID or any other value that makes sense to the application. Other columns provide numerical values for the coordinates of the record that are used by clustering algorithms. Result Set must contain at least dim + 1 columns.
- dim - The dimensionality of the model, i.e. the number of the coordinates consumed by clustering algorithm.
- nullReplacement - Optional, of specified this is a numeric replacement for empty values.
method SubsetCentroid(key As %String, Output z)
Iterates over all the data points assigned to a given cluster.
Cluster is identified by its ordinal number k
method printAll()
Convenience method.
Writes all data points in the dataset to the default output device.
method printCluster(k As %Integer)
Convenience method.
Writes all data points assigned to a given cluster to the default output device.
Cluster is identified by its ordinal number k
Inherited Members
Inherited Methods
- %AddToSaveSet()
- %ClassIsLatestVersion()
- %ClassName()
- %ConstructClone()
- %DispatchClassMethod()
- %DispatchGetModified()
- %DispatchGetProperty()
- %DispatchMethod()
- %DispatchSetModified()
- %DispatchSetMultidimProperty()
- %DispatchSetProperty()
- %Extends()
- %GetParameter()
- %IsA()
- %IsModified()
- %New()
- %NormalizeObject()
- %ObjectModified()
- %OriginalNamespace()
- %PackageName()
- %RemoveFromSaveSet()
- %SerializeObject()
- %SetModified()
- %ValidateObject()