This post is intended to be a quick and dirty introduction to Formal Concept Analysis – unadulterated by all the things that would make it easier to understand.

I have a series of presentations on SlideShare that introduces Formal Concept Analysis through a recommender systems example. I did rip off the basic example to use here, but I actually stripped it down to its bare essence. Look there if you are looking for a motivated, and slightly slower, introduction. I’m also not going to be terribly pedantic – e.g., no theorems, proofs or exercises. So, if you are looking for the real math of Formal Concept Analysis, you want to start with the book by Ganter and Wille.

Here, I’m just going to jump right in.

Incidence relations

A number of problems involve some form of incidence relation – the recommender example I use in the presentations has Users and Items, but they show up in a number of places. For FCA, an incidence relation is a binary relation between objects and attributes. For this post, we work with a formal context that consists of a set of objects, a set of attributes, and the incidence relation .

We can also encounter an incidence relation that is weighted, where for some domain of weights. In this case, it is possible to scale the weights so that we could created an unweighted context with attributes that represent the original attributes with the scaled weight. You can think of the scaling as mapping into in the context where the attributes are elements of .

Different scalings will give us different unweighted incidence relations, and the “right” choice depends on the data and how we should interpret it. So, while, technically, it is sufficient to look at the unweighted cases, eventually we will want to consider alternatives.

Partially ordered sets and lattices

Let be a set, then is a partially ordered set (poset) when the order is a relation on that is

  1. reflexive: , ,
  2. anti-symmetric: if and then , , and
  3. transitive: if and then , .

For , we say that covers , written , if and there is no such that . If the poset has an element so that for all , then is called the bottom of the poset and written as . Similarly, the top of a poset, written , is an element such that for all .

For a poset and , the least upper bound of is where and , ; and the greatest lower bound of is where and , . If and exist for any set then is a (complete) lattice. A complete lattice has both a top and bottom.

A standard example of a lattice is the powerset of a set. For , the set of objects of a formal context , the powerset of is , the set of subsets of . is a poset ordered by set inclusion, and is a lattice with set union as least upper bound, and set intersection as greatest lower bound. The top of is and the bottom (the empty set). The powerset is an important example, because it is the canonical Boolean algebra, and is also a major part of the construction we consider in the next section.

The dual of a poset is where the order is flipped. So, is the dual lattice of . In this lattice, the top is and the bottom is .

We draw lattices using the covering relation (a Hasse diagram). The top of lattice is drawn at the top. Then for any element in the diagram, add any elements and draw with a line from to . The drawing will stop at .

Abstracting the example from the slides, let . Then the powerset lattice can be drawn as

diagram of powerset lattice: empty set at bottom with singleton sets above, sets of pairs above that – adding one element at each level with sets connected to indicate subsets

where I’ve left off the set notation.

Extending the incidence to powersets

Let’s get concrete with a formal context. I’m using uppercase letters to represent objects, so ; and lowercase letters to represent attributes, so . The incidence relation (as a cross table) is

 
x x      
x x x x  
x x x x x
  x   x x

The entries in this table show us which pairs belong to the relation: the ‘x’ the table entry for row and column means that .

The incidence relates the lattices and through two functions:

  1. , defined as for , and
  2. , defined as for .

These functions form a special relationship between the powersets of objects and attributes that is called a Galois connection.

In general, a pair of functions and between posets and is a Galois connection between and when

  1. if then ,
  2. if then , and
  3. if and .

It turns out that the functions defined from the incidence relation partition the powerset lattices in a special way so that the relationship between sets of objects and attributes that is hidden in the incidence relation is captured. To see this, let’s start with the set of objects and consider what happens when we add other objects:

Notice that maps the sets between and to the attribute set , and the sets between and to . These ranges of sets are called intervals, and for elements of a poset the interval is the set .

Going the other way, let’s focus on subsets of :

If we look closely we can see that what is happening is that these functions directly relate intervals of each of the powerset lattice with each other. For our example, the relation identifies six intervals in each lattice that are related by the functions.

The four element powerset lattice for objects is on the left, and the dual of the five element powerset lattice on the right, each partitioned into six intervals that are related by the functions derived from the incidence relation.

To be precise, what is happening is that maps all of the elements of each interval of to the minimum element of the corresponding interval in (in other words, the largest set in the interval), and vice versa. This means the composition of the two functions gives us closure operators

This construction gives us the basic idea of formal concept analysis – that certain pairs of object sets and attribute sets represent the fundamental relationships in the incidence relation.

Formal concepts and the concept lattice

The pairs of sets identified by the Galois connection are the formal concepts for the context – defined as pairs of sets and satisfying and . The set of objects is called the extent, and the set of attributes is the intent. In terms of notation, for formal concept , the extent is , and the intent is . We can use also the closure directly to construct concepts. Given a set , we define , and given a set , we define .

The canonical partial order on formal concepts is the subconcept order. Define whenever , or, equivalently, whenever . The set of concepts over the incidence relation (technically, the formal concept ) forms a lattice relative to the subconcept order.

To have a complete lattice, we have to have a least upper bound and greatest lower bound for any set of concepts. Given a set of concepts , the least upper bound is defined as

and the greatest lower bound is defined as

Notice that the intersection is natural in the lattice, while the union requires applying the appropriate closure operator. When we just have a pair of concepts and , the least upper bound, or _join, is written , and the greatest lower bound, or _meet, is written .

The concept lattice for our example looks like this

Concept lattice has six concepts: top with all four objects, bottom with all five attributes

It is common to simplify the labeling of a lattice diagram using the functions we defined above. If we look in the lattice above above , for attribute , every concept has in it. And, if we look at the lattice below , , we see that every concept has . So, the convention is to label and for each and rather than to label with the full concepts. For our example, this looks like

Incidence and lattices

The concept lattice captures relationships among the objects and attributes that are implicit in the incidence relation. Sometimes a context will have objects or attributes that effectively don’t add any new relationships – they are simply part of relationships that would be there regardless. This happens when the corresponding concepts are either join- or meet-reducible.

A concept is join-reducible whenever can be expressed as a join of strict subconcepts: , or meet-reducible whenever can be expressed as a meet of strict superconcepts: . The concept labeled by and in the following diagram is both join- and meet-reducible: the concept is the join of the concepts , , ; and the meet of the concepts through .

In general, if the concept , then the object is called join-reducible; and if the concept , then the attribute is called meet-reducible.

The implication is that a reducible object or attribute can be removed without affecting the structure of the lattice through changes to the concepts. So, in this example diagram, we can remove the object and the attribute without changing the structure. We can also remove the attribute in the top and the object in the bottom since they are trivially reducible. It is also possible to remove objects or attributes that share exactly the same attributes or objects as another. These two cases are easy to recognize in the cross table, because duplicates will have duplicate rows or columns, an object that corresponds to the bottom will have a row of x’s, and an attribute that is the top will appears as a column of all x’s. A context where duplicates are removed is called _clarified*, and one where both join and meet reducible elements are removed is called reduced.

So, for any particular formal context, there is a family of formal contexts that yield isomorphic concept lattices – identical up to labeling – where some have more labels and some have fewer. And, when the context is finite, there is a canonical clarified and reduced context called the standard context that determines the structure of the lattice for all of the contexts in this family. It is possible to create the standard context from a concept lattice (for the details, see Ganter and Wille).

Epilogue

We have explored the basic definitions and constructions used in Formal Concept Analysis to discover relationships among attributes and objects in an incidence relation. As I discuss elsewhere, the incidence relation is a common form of data seen in applications such as biomedical research and recommender systems. The concept lattice can be used to describe common data mining constructions such as association rules and decision trees – with the lattice structure allowing the definition of heuristics for association rule and decision tree discovery. Beyond direct application, the lattice provides insight into the structure of the data, in particular the true dimensionality of a data set, since large data sets can collapse to relatively small structures because of redundancies. For moving beyond the unweighted case, the Galois connection is an important construction to remember, but there is more to consider before we get there.