📘 Formal convex concepts

📘 Formal convex concepts#

Formal convex concepts are the building blocks of formal concept analysis (FCA), representing the relationships between a set of items and their patterns. In the GALACTIC framework, formal convex concepts are implemented using the Concept class of the galactic.algebras.convex.descriptions.core module, which allows for the creation, manipulation, and analysis of these concepts within a given antitone Galois connection.

Creating convex concepts#

The constructor of the Concept class takes an instance of the GaloisConnection class as input, which defines the context in which the concepts are formed and optionally an iterable of items or attributes to initialise the concept. When neither items nor attributes are provided, the concept is initialised as the top concept (with full extent and smallest intent).

<galactic.algebras.convex.descriptions.core.Concept object at 0x72b7dfead360>

The extent and intent of the concept can be accessed using the extent and intent attributes, respectively. They are closed sets of items and attributes within the context of the antitone Galois connection.

display(top.extent, list(top.extent))
display(top.intent, [str(attr) for attr in top.intent])
display(bottom.extent, list(bottom.extent))
display(bottom.intent, [str(attr) for attr in bottom.intent])
<galactic.algebras.convex.descriptions.core.Extent object at 0x72b7e0c9a500>
[Item(key=0, value=36),
 Item(key=1, value=48),
 Item(key=2, value=16),
 Item(key=3, value=32)]
<galactic.algebras.convex.descriptions.core.Intent object at 0x72b7dfea45c0>
['M(int(@),4)']
<galactic.algebras.convex.descriptions.core.Extent object at 0x72b7dfea6d40>
[]
<galactic.algebras.convex.descriptions.core.Intent object at 0x72b7dfea4680>
['⊥']

Operating on concepts#

The Concept class implements the Element protocol of the galactic.algebras.lattice.core module, which also provides methods to create concepts using the join (\(\vee\)) or meet (\(\wedge\)) operators.

concept_1 = Concept(
    connection=connection,
    items=[context.domain[1], context.domain[2]],
)
concept_2 = Concept(
    connection=connection,
    items=[context.domain[0]],
)
join = concept_1 | concept_2
meet = concept_1 & concept_2
display(concept_1.extent, list(concept_1.extent))
display(concept_1.intent, [str(attr) for attr in concept_1.intent])
display(concept_2.extent, list(concept_2.extent))
display(concept_2.intent, [str(attr) for attr in concept_2.intent])
display(concept_2.intent, [str(attr) for attr in concept_2.intent.convexes[0]])
display(meet.extent, list(meet.extent))
display(meet.intent, [str(attr) for attr in meet.intent])
display(join.extent, list(join.extent))
display(join.intent, [str(attr) for attr in join.intent])
display(meet <= join, meet.extent <= join.extent, meet.intent >= join.intent)
<galactic.algebras.convex.descriptions.core.Extent object at 0x72b7dfed4740>
[Item(key=1, value=48), Item(key=2, value=16), Item(key=3, value=32)]
<galactic.algebras.convex.descriptions.core.Intent object at 0x72b7dfecba80>
['M(int(@),16)']
<galactic.algebras.convex.descriptions.core.Extent object at 0x72b7dfed4200>
[Item(key=0, value=36)]
<galactic.algebras.convex.descriptions.core.Intent object at 0x72b7dfed12c0>
['M(int(@),4)', 'M(int(@),9)']
<galactic.algebras.convex.descriptions.core.Intent object at 0x72b7dfed12c0>
['M(int(@),4)', 'M(int(@),9)']
<galactic.algebras.convex.descriptions.core.Extent object at 0x72b7dfed6a40>
[]
<galactic.algebras.convex.descriptions.core.Intent object at 0x72b7dfed6d80>
['⊥']
<galactic.algebras.convex.descriptions.core.Extent object at 0x72b7dfed4700>
[Item(key=0, value=36),
 Item(key=1, value=48),
 Item(key=2, value=16),
 Item(key=3, value=32)]
<galactic.algebras.convex.descriptions.core.Intent object at 0x72b7dfed5d00>
['M(int(@),4)']
True
True
True