fca.base_models

Base representation of the basic classes of FCA

Ideally, with the exception of Concept, these classes are only internal, and it should not be necessary to use them.

Module Contents

Classes

Context

Base representation of a formal context

Concept

Base representation of a formal concept

class fca.base_models.Context(O, A, I: List[List[int]])

Base representation of a formal context

__init__(O, A, I: List[List[int]])
Parameters:
  • O (List[str]) – a list of objects. len(O) = n

  • A (List[str]) – a list of attributes. len(A) = m

  • I (List[List[int]]) – a n m incidence matrix, beign I[i][j] = 1 if object i has the attribute j, 0 <= i <= n, 0 <= j <= m

derivative(Y, is_attr: bool = True)
Parameters:
  • Y (List[int]) – A subset indices of self.A or self.O

  • is_attr (bool) – Whether Y subseteq A or Y subseteq O

class fca.base_models.Concept(context: Context, O, A, parents=None, children=None)

Base representation of a formal concept

property X
property Y
__init__(context: Context, O, A, parents=None, children=None)
in_extent(o: int) bool

Whether the object o is in its extent

add_child(concept)
remove_child(concept)
to_tuple()
Returns:

A tuple consisting of (obj, attr) where obj and attr are the lists of corresponding strings

hr_O()
Returns:

The list of the corresponding object strings

hr_A()
Returns:

The list of the corresponding attribute strings