ClusteringSimilarityFunction
index
../../../../piana/code/Clustering/ClusteringSimilarityFunction.py

File        : ClusteringSimilarityFunction.py
Author      : Pablo Boixeda & Ramon Aragues
Creation    : 4.2005
Contents    : implements the template for a clustering similarity function
Called from : Clustering.py
 
=======================================================================================================
 
This class implements the template that has to be followed by clustering similarity functions.
 
A similarity function determines how similar two clusters are.

 
Modules
       
LinearAlgebra
PianaGlobals
fgraph
getopt
numarray
piana_configuration_parameters
re
readline
sys

 
Classes
       
__builtin__.object
ClusteringSimilarityFunction

 
class ClusteringSimilarityFunction(__builtin__.object)
    This class implements the template that has to be followed by clustering similarity functions.
 
A similarity function determines how similar two clusters are.
 
  Methods defined here:
__init__(self, dbaccess=None, mode=None, path_length_threshold_value=None)
"dbaccess" is a database accession object used to access information from a database, in case the similarity function needs information
that is not contained in the node itself. If not being used, just set to None
 
"mode" defines how to evaluate the distance between two clusters:
  - random takes a random element from each cluster and evaluates similarity between them
  - min takes the minimal distance between elements of each cluster
  - max takes the maximal distance between elements of each cluster
  - average takes the average distance between all elements of each cluster
calculate_similarity(self, list_node_attributes1, list_node_attributes2)
Method that returns similarity score from two lists of attributes of nodes that are being clustered
 
"list_node_attributes1" is a list of node attributes that belong to the same cluster
 
"list_node_attributes2" is a list of node attributes that belong to the same cluster
 
This method calculates how similar this two clusters are
 
Attention: this is the method that has to be overriden by the specific clustering you are implementing
get_index_to_node_id(self)
Method that returns the correspondence between
matrix indexes and GraphNode ids
get_max_value(self)
method that returns max  value from
the similarity matrix
get_node_id_by_index(self, number)
Method that returns the correnspondendence betrween a given index to a node_id
get_similarity_matrix(self, cluster_graph, dbaccess=None)
Method that returns similarity matrix from a given cluster graph "cluster_graph"
 
each position in the matrix indicates how similar two clusters are.

Data and other attributes defined here:
__dict__ = <dictproxy object>
dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'ClusteringSimilarityFunction' objects>
list of weak references to the object (if defined)

 
Data
        root_nodes = {}
verbose = 1
verbose_add_edge_detailed = 0
verbose_add_edge_shallow = 0
verbose_expansion_detailed = 0
verbose_expansion_minimal = 1
verbose_expansion_shallow = 0
verbose_get_edge = 0
verbose_get_node = 0
verbose_has_edge = 0
verbose_join = 0
verbose_propagate = 0
verbose_propagate_print = 0