architxt.simplification.tree_rewriting.operations.groups

architxt.simplification.tree_rewriting.operations.groups#

Classes

FindSubGroupsOperation(*, tau, min_support, ...)

Identifies and create subgroup of entities for each subtree.

MergeGroupsOperation(*, tau, min_support, metric)

Attempt to add ENT to an existing ` GROUP ` within a tree.

class architxt.simplification.tree_rewriting.operations.groups.FindSubGroupsOperation(*, tau, min_support, metric)[source]#

Bases: Operation

Identifies and create subgroup of entities for each subtree.

It creates a group only if the support of the newly created subgroup is greater than the support of the subtree.

apply(tree, *, equiv_subtrees)[source]#

Apply the rewriting operation on the given tree.

Parameters:
  • tree (Tree) – The tree to perform the reduction on.

  • equiv_subtrees (dict[str, Sequence[Tree]]) – The cluster of equivalent subtrees in the forest.

Return type:

bool

Returns:

A boolean indicating whether the operation modified the tree (True) or left it unaltered (False).

class architxt.simplification.tree_rewriting.operations.groups.MergeGroupsOperation(*, tau, min_support, metric)[source]#

Bases: Operation

Attempt to add ENT to an existing ` GROUP ` within a tree.

It tries to form a new GROUP node that does not reduce the support of the given group.

apply(tree, *, equiv_subtrees)[source]#

Apply the rewriting operation on the given tree.

Parameters:
  • tree (Tree) – The tree to perform the reduction on.

  • equiv_subtrees (dict[str, Sequence[Tree]]) – The cluster of equivalent subtrees in the forest.

Return type:

bool

Returns:

A boolean indicating whether the operation modified the tree (True) or left it unaltered (False).