📘 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 optionnally an iterable of items or attributes to initialize the concept. When neither items nor attributes are provided, the concept is initialized as the top concept (with full extent and smallest intent).

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

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, list(top.intent))
display(bottom.extent, list(bottom.extent))
display(bottom.intent, list(bottom.intent))
<galactic.algebras.convex.descriptions.core.Extent object at 0x711d28464180>
[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 0x711d28464500>
[<galactic.algebras.convex.predicates.examples.arithmetic.core.Multiple object at 0x711d28464780>]
<galactic.algebras.convex.descriptions.core.Extent object at 0x711d300ef9c0>
[]
<galactic.algebras.convex.descriptions.core.Intent object at 0x711d284644c0>
[<galactic.algebras.convex.predicates.core.Absurd object at 0x711d28464d80>]

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,
    items=[context.domain[1], context.domain[2]],
)
concept_2 = Concept(
    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(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 0x711d285dd6c0>
[Item(key=1, value=48), Item(key=2, value=16), Item(key=3, value=32)]
<galactic.algebras.convex.descriptions.core.Intent object at 0x711d28478bc0>
['M(int($),16)']
<galactic.algebras.convex.descriptions.core.Extent object at 0x711d28611480>
[Item(key=0, value=36)]
<galactic.algebras.convex.descriptions.core.Intent object at 0x711d28478c80>
['M(int($),4)', 'M(int($),9)']
<galactic.algebras.convex.descriptions.core.Extent object at 0x711d28478680>
[]
<galactic.algebras.convex.descriptions.core.Intent object at 0x711d2855e540>
['⊥']
<galactic.algebras.convex.descriptions.core.Extent object at 0x711d305002c0>
[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 0x711d300f8280>
['M(int($),4)']
True
True
True