Package ML :: Package Cluster :: Module Murtagh
[hide private]
[frames] | no frames]

Module Murtagh

source code

Interface to the C++ Murtagh hierarchic clustering code



Functions [hide private]
 
_LookupDist(dists, i, j, n)
*Internal Use Only*...
source code
 
_ToClusters(data, nPts, ia, ib, crit, isDistData=0)
*Internal Use Only*...
source code
 
ClusterData(data, nPts, method, isDistData=0)
clusters the data points passed in and returns the cluster tree **Arguments** - data: a list of lists (or array, or whatever) with the input data (see discussion of _isDistData_ argument for the exception) - nPts: the number of points to be used - method: determines which clustering algorithm should be used.
source code
Variables [hide private]
  WARDS = 1
  SLINK = 2
  CLINK = 3
  UPGMA = 4
  MCQUITTY = 5
  GOWER = 6
  CENTROID = 7
  methods = [('Ward\'s Minimum Variance', 1, 'Ward\'s Minimum Va...
  Complex0 = 'F'
  Complex16 = 'F'
  Complex32 = 'F'
  Complex64 = 'D'
  Complex8 = 'F'
  Float0 = 'f'
  Float16 = 'f'
  Float32 = 'f'
  Float64 = 'd'
  Float8 = 'f'
  Int0 = '1'
  Int16 = 's'
  Int32 = 'i'
  Int8 = '1'
  absolute = <ufunc 'absolute'>
  add = <ufunc 'add'>
  arccos = <ufunc 'arccos'>
  arccosh = <ufunc 'arccosh'>
  arcsin = <ufunc 'arcsin'>
  arcsinh = <ufunc 'arcsinh'>
  arctan = <ufunc 'arctan'>
  arctan2 = <ufunc 'arctan2'>
  arctanh = <ufunc 'arctanh'>
  bitwise_and = <ufunc 'bitwise_and'>
  bitwise_or = <ufunc 'bitwise_or'>
  bitwise_xor = <ufunc 'bitwise_xor'>
  ceil = <ufunc 'ceil'>
  conjugate = <ufunc 'conjugate'>
  cos = <ufunc 'cos'>
  cosh = <ufunc 'cosh'>
  divide = <ufunc 'divide'>
  divide_safe = <ufunc 'divide_safe'>
  e = 2.71828182846
  equal = <ufunc 'equal'>
  exp = <ufunc 'exp'>
  fabs = <ufunc 'fabs'>
  floor = <ufunc 'floor'>
  floor_divide = <ufunc 'floor_divide'>
  fmod = <ufunc 'fmod'>
  greater = <ufunc 'greater'>
  greater_equal = <ufunc 'greater_equal'>
  hypot = <ufunc 'hypot'>
  invert = <ufunc 'invert'>
  left_shift = <ufunc 'left_shift'>
  less = <ufunc 'less'>
  less_equal = <ufunc 'less_equal'>
  log = <ufunc 'log'>
  log10 = <ufunc 'log10'>
  logical_and = <ufunc 'logical_and'>
  logical_not = <ufunc 'logical_not'>
  logical_or = <ufunc 'logical_or'>
  logical_xor = <ufunc 'logical_xor'>
  maximum = <ufunc 'maximum'>
  minimum = <ufunc 'minimum'>
  multiply = <ufunc 'multiply'>
  negative = <ufunc 'negative'>
  not_equal = <ufunc 'not_equal'>
  pi = 3.14159265359
  power = <ufunc 'power'>
  remainder = <ufunc 'remainder'>
  right_shift = <ufunc 'right_shift'>
  sin = <ufunc 'sin'>
  sinh = <ufunc 'sinh'>
  sqrt = <ufunc 'sqrt'>
  subtract = <ufunc 'subtract'>
  tan = <ufunc 'tan'>
  tanh = <ufunc 'tanh'>
  true_divide = <ufunc 'true_divide'>
Function Details [hide private]

_LookupDist(dists, i, j, n)

source code 
*Internal Use Only*

returns the distance between points i and j in the symmetric
distance matrix _dists_

_ToClusters(data, nPts, ia, ib, crit, isDistData=0)

source code 
*Internal Use Only*

Converts the results of the Murtagh clustering code into
a cluster tree, which is returned in a single-entry list

ClusterData(data, nPts, method, isDistData=0)

source code 
clusters the data points passed in and returns the cluster tree

**Arguments**

  - data: a list of lists (or array, or whatever) with the input
    data (see discussion of _isDistData_ argument for the exception)

  - nPts: the number of points to be used

  - method: determines which clustering algorithm should be used.
      The defined constants for these are:
      'WARDS, SLINK, CLINK, UPGMA'

  - isDistData: set this toggle when the data passed in is a
      distance matrix.  The distance matrix should be stored
      symmetrically so that _LookupDist (above) can retrieve
      the results:
        for i<j: d_ij = dists[j*(j-1)/2 + i]


**Returns**

  - a single entry list with the cluster tree


Variables Details [hide private]

methods

Value:
[('Ward\'s Minimum Variance', 1, 'Ward\'s Minimum Variance'),
 ('Average Linkage', 4, 'Group Average Linkage (UPGMA)'),
 ('Single Linkage', 2, 'Single Linkage (SLINK)'),
 ('Complete Linkage', 3, 'Complete Linkage (CLINK)'),
 ('Centroid', 7, 'Centroid method')]