wiki:ModuleFunctionClustering

Version 2 (modified by bozo_i, 12 years ago) (diff)

--

About clustering

The clustering algorithm sorts entities into groups, that are closely related from different point of view. The entities can be modules or functions and the relations between them are function calls and record usages. The created groups are called clusters.

Clustering in RefactorErl

Before using the clustering functionality of the tool, the source files have to be loaded to the database. The clustering algorithm will cluster all the modules and functions which are in the database. In the clustering options the user can choose the modules and functions that should be ignored during the clustering.

Types of clustering

There are two implemented clustering algorithms in RefactorErl:

  • Hierarchical algorithm (agglomerative)
  • Genetic algorithm

Agglomerative clustering

In the beginning, each entity forms a separate cluster. Then, in each step, the two closest clusters are selected and unified. This process continues until there is only one cluster. The intermediate states contain a possible clustering of the entities. The output of the algorithm is the list of these possible clusterings.

Genetic clustering

Genetic algorithms simulate the evolution of species. There are iterations of populations in which every entity figths for survival or for the survival of its genes. A fitness function is defined to determine the value of an entity. The fitter an entity is, the more likely it survives. The algorithm is expected to converge to the fittest possible entity, like evolution does.

Using the clustering functionality

The clustering functionality is available from Emacs and the console interface.

Parameters for agglomerative clustering

  • Modules to skip: The list of module names (separated by space or comma characters) that should be ignored in the clustering process
  • Functions to skip: The list of function names (separated by space or comma characters) that should be ignored in the clustering process
  • Transform function: The function that transforms the attribute matrix before running the clustering. There are two options for the transformation: zero_one and none.
    • zero_one: The option zero_one means that the weights that are positive in the attribute matrix will be transformed to 1.
    • none: The option none means that no transformation will be performed in the attribute matrix.
  • Distance function: It can be call_sum, weight or a function reference to user-defined function.
    • call_sum:
    • weight:
    • User-defined function:
  • Antigravity:
  • Merge function:
    • smart

TODO

Parameters for genetic clustering

TODO