Package rdkit :: Package ML :: Package Cluster :: Module Clusters :: Class Cluster

[hide private]
[frames] | no frames]

# Class Cluster

source code

    object --+
             |
            Cluster

    a class for storing clusters/data

    **General Remarks**

     - It is assumed that the bottom of any cluster hierarchy tree is composed of
       the individual data points which were clustered.

     - Clusters objects store the following pieces of data, most are
        accessible via standard Setters/Getters:

       - Children: *Not Settable*, the list of children.  You can add children
         with the _AddChild()_ and _AddChildren()_ methods.

         **Note** this can be of arbitrary length,
         but the current algorithms I have only produce trees with two children
         per cluster

       - Metric: the metric for this cluster (i.e. how far apart its children are)

       - Index: the order in which this cluster was generated

       - Points: *Not Settable*, the list of original points in this cluster
            (calculated recursively from the children)

       - PointsPositions: *Not Settable*, the list of positions of the original
          points in this cluster (calculated recursively from the children)

       - Position: the location of the cluster **Note** for a cluster this
         probably means the location of the average of all the Points which are
         its children.

       - Data: a data field.  This is used with the original points to store their
         data value (i.e. the value we're using to classify)

       - Name: the name of this cluster

Instance Methods | [hide private]

__init__(self, metric=0.0, children=None, position=None, index=-1, name=None, data=None) Constructor | source code

SetMetric(self, metric) | source code

GetMetric(self) | source code

SetIndex(self, index) | source code

GetIndex(self) | source code

SetPosition(self, pos) | source code

GetPosition(self) | source code

GetPointsPositions(self) | source code

GetPoints(self) | source code

FindSubtree(self, index) finds and returns the subtree with a particular index... | source code

_GenPoints(self) Generates the _Points_ and _PointsPositions_ lists | source code

AddChild(self, child) Adds a child to our list | source code

AddChildren(self, children) Adds a bunch of children to our list | source code

RemoveChild(self, child) Removes a child from our list | source code

GetChildren(self) | source code

SetData(self, data) | source code

GetData(self) | source code

SetName(self, name) | source code

GetName(self) | source code

Print(self, level=0, showData=0, offset='\t') | source code

Compare(self, other, ignoreExtras=1) not as choosy as self==other | source code

_UpdateLength(self) updates our length | source code

IsTerminal(self) | source code

__len__(self) allows _len(cluster)_ to work | source code

__cmp__(self, other) allows _cluster1 == cluster2_ to work | source code

Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Properties | [hide private]

Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, metric=0.0, children=None, position=None, index=-1, name=None, data=None)
(Constructor)

source code

    Constructor

    **Arguments**

      see the class documentation for the meanings of these arguments

      *my wrists are tired*

Overrides: object.__init__

### FindSubtree(self, index)

source code

    finds and returns the subtree with a particular index

### _GenPoints(self)

source code

    Generates the _Points_ and _PointsPositions_ lists

    *intended for internal use*

### AddChild(self, child)

source code

    Adds a child to our list

    **Arguments**

      - child: a Cluster

### AddChildren(self, children)

source code

    Adds a bunch of children to our list

    **Arguments**

      - children: a list of Clusters

### RemoveChild(self, child)

source code

    Removes a child from our list

    **Arguments**

      - child: a Cluster

### _UpdateLength(self)

source code

    updates our length

    *intended for internal use*