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 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 (set[tuple[Tree, …]]) – The cluster of equivalent subtrees in the forest.

Return type:

tuple[Tree, bool]

Returns:

A tuple containing the transformed tree and a boolean flag. The boolean flag typically indicates 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 existing GROUP within a tree.

It tries to form a new GROUP nodes 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 (set[tuple[Tree, …]]) – The cluster of equivalent subtrees in the forest.

Return type:

tuple[Tree, bool]

Returns:

A tuple containing the transformed tree and a boolean flag. The boolean flag typically indicates whether the operation modified the tree (True) or left it unaltered (False).