mathematics of incidence (part 2): formal concepts and formal concept lattices

35
Mathematics of Incidence part 2: formal concepts and formal concept lattices Benjamin J. Keller bjkeller.github.io v.1, 3 October 2014 Creative Commons Attribution-ShareAlike 4.0 International License apples cherries Charles Brian Abby

Upload: benjamin-keller

Post on 29-Nov-2014

156 views

Category:

Data & Analytics


0 download

DESCRIPTION

Continuing the tale of Abby and doughnuts from part 1, this presentation shifts terminology and notation into formal concept analysis, and introduces lattice ideals and filters that allow us to better describe what's going on with collaborative filtering.

TRANSCRIPT

Page 1: Mathematics of incidence (part 2): formal concepts and formal concept lattices

Mathematics of Incidencepart 2: formal concepts and formal concept lattices !Benjamin J. Kellerbjkeller.github.io!v.1, 3 October 2014

Creative Commons Attribution-ShareAlike 4.0 International License

bananas

doughnutsapples

eggscherries

Charles

David

Brian

Abby

Page 2: Mathematics of incidence (part 2): formal concepts and formal concept lattices

Recall: Collaborative Filtering

Abby

Brian

Charles

David

cherries

doughnuts

eggs

apples

bananas

Use likes of users to recommend foods to Abby

Recommend these three foods to Abby because she likes food in common with users who like them

Page 3: Mathematics of incidence (part 2): formal concepts and formal concept lattices

Recall: Likes represented as bipartite graph

Abby

Brian

Charles

David

apples

bananas

cherries

doughnuts

eggs

bipartite graph (U,V,E) has vertices in disjoint sets U and V with edges (u,v) in E from vertex u in U to vertex v in V

Page 4: Mathematics of incidence (part 2): formal concepts and formal concept lattices

Recall: Biclique

Abby

Brian

Charles

David

apples

bananas

cherries

doughnuts

eggs

A biclique (U,V,E) of a bipartite graph G is a subgraph of G such that each u in U has an edge (u,v) with each v in V

Page 5: Mathematics of incidence (part 2): formal concepts and formal concept lattices

Recall: Recommendations via bicliques

Abby

Brian

Charles

David

apples

bananas

cherries

doughnuts

eggs

Construct same recommendation by composing bicliques

Abby

Brian

Charles

David

apples

bananas

cherries

doughnuts

eggs

Abby Charles

David

cherries

doughnuts

eggs

apples

bananas

Brian

Page 6: Mathematics of incidence (part 2): formal concepts and formal concept lattices

Shift perspectives: Formal Concept Analysis

• Starts with Formal Context ⟨ G,M,I ⟩

• Set of objects G

• Set of attributes M

• Incidence relation I ⊆GxM

• Derive formal concepts (basically bicliques) from incidence relation

• Constructs Formal Concept Lattice

Page 7: Mathematics of incidence (part 2): formal concepts and formal concept lattices

"Likes" Formal ContextG = { Abby, Brian, Charles, David }

M = { apples, bananas, cherries, doughnuts, eggs }

I = { (Abby, apples), (Abby, bananas), (Brian, apples),(Brian, bananas),(Brian, cherries), (Brian, doughnuts), (Charles, apples), (Charles, bananas), (Charles, cherries), (Charles, doughnuts), (Charles, eggs), (David, bananas), (David, doughnuts), (David, eggs) }

Page 8: Mathematics of incidence (part 2): formal concepts and formal concept lattices

Representing incidence relationAbby

Brian

Charles

David

apples

bananas

cherries

doughnuts

eggs

apples bananas cherries doughnuts eggs

Abby X X

Brian X X X X

Charles X X X X X

David X X X

Can represent incidence relation as a bipartite graph, but commonly represented as a cross table

Page 9: Mathematics of incidence (part 2): formal concepts and formal concept lattices

Definition: Partially ordered set

(P,) is a partially ordered set (poset) when the order satisfies the properties

p q q p p = q 8p, q 2 Pif and then

8p, q, r 2 Pq r p rp qif and then

(reflexivity)

(antisymmetry)

(transitivity)

p p 8p 2 P

Page 10: Mathematics of incidence (part 2): formal concepts and formal concept lattices

Definition: Lattice

(L,) S ✓ LFor a poset andW

S = p

p 2 L 8s 2 S, s p

the least upper bound of is

where and

S

VS = q

q 2 L 8s 2 S, q s

the greatest lower bound of is

where and

S

Lexist for any set S ✓ L

VS

WSIf and

then is a (complete) lattice

Page 11: Mathematics of incidence (part 2): formal concepts and formal concept lattices

(Boolean) Lattice of powerset

• The powerset of G is set of subsets of G

• Ordered by inclusion is a poset

• And, is a lattice:

• Set union as least upper bound

• Set intersection as greatest lower bound

Charles DavidBrianAbby

Abby, Brian

Abby, Charles

Abby, David

Brian, Charles

Brian, David

Charles, David

Abby, Brian,

Charles

Abby, Brian, David

Brian, Charles,

David

Abby, Charles,

David

Abby, Brian,

Charles,David

P(G)

Page 12: Mathematics of incidence (part 2): formal concepts and formal concept lattices

Incidence relates powersets

Charles DavidBrianAbby

Abby, Brian

Abby, Charles

Abby, David

Brian, Charles

Brian, David

Charles, David

Abby, Brian,

Charles

Abby, Brian, David

Brian, Charles,

David

Abby, Charles,

David

Abby, Brian,

Charles,David

eggsdoughnutscherriesbananasapples

apples, bananas

apples, cherries

apples,doughnuts

apples, eggs

bananas, cherries

bananas,doughnuts

bananas, eggs

cherries,doughnuts

cherries, eggs

doughnuts, eggs

apples, bananas, cherries

apples, bananas,

eggs

apples, bananas,

doughnuts

apples, cherries,

doughnuts

apples, cherries,

eggs

apples,doughnuts,

eggs

bananas, cherries,

doughnuts

bananas, cherries,

eggs

bananas,doughnuts,

eggs

cherries,doughnuts,

eggs

apples, bananas, cherries,

doughnuts

apples, bananas, cherries,

eggs

apples, bananas,

doughnuts, eggs

apples, cherries,

doughnuts, eggs

bananas, cherries,

doughnuts, eggs

apples, bananas, cherries,

doughnuts, eggs

the dual lattice (order is flipped), so “upside-down”

(P(G),✓) (P(M),◆)

Page 13: Mathematics of incidence (part 2): formal concepts and formal concept lattices

Deriving functions from incidence

� : P(G) ! P(M)

: P(M) ! P(G)

�(A) = {b 2 M | (a, b) 2 I}

A ✓ Gfor

(B) = {a 2 G | (a, b) 2 I}

B ✓ Mfor

Page 14: Mathematics of incidence (part 2): formal concepts and formal concept lattices

Incidence relates powersets

Charles DavidBrianAbby

Abby, Brian

Abby, Charles

Abby, David

Brian, Charles

Brian, David

Charles, David

Abby, Brian,

Charles

Abby, Brian, David

Brian, Charles,

David

Abby, Charles,

David

Abby, Brian,

Charles,David

eggsdoughnutscherriesbananasapples

apples, bananas

apples, cherries

apples,doughnuts

apples, eggs

bananas, cherries

bananas,doughnuts

bananas, eggs

cherries,doughnuts

cherries, eggs

doughnuts, eggs

apples, bananas, cherries

apples, bananas,

eggs

apples, bananas,

doughnuts

apples, cherries,

doughnuts

apples, cherries,

eggs

apples,doughnuts,

eggs

bananas, cherries,

doughnuts

bananas, cherries,

eggs

bananas,doughnuts,

eggs

cherries,doughnuts,

eggs

apples, bananas, cherries,

doughnuts

apples, bananas, cherries,

eggs

apples, bananas,

doughnuts, eggs

apples, cherries,

doughnuts, eggs

bananas, cherries,

doughnuts, eggs

apples, bananas, cherries,

doughnuts, eggs

Page 15: Mathematics of incidence (part 2): formal concepts and formal concept lattices

Functions relate powersets

Abby

Abby, Brian

Abby, Charles

Abby, Brian,

Charles

apples

apples, bananas

�({Abby}) = {apples, bananas}�({Abby ,Brian}) = {apples, bananas}

�({Abby ,Charles}) = {apples, bananas}�({Abby ,Brian,Charles}) = {apples, bananas}

({apples}) = {Abby ,Brian,Charles} ({apples, bananas}) = {Abby ,Brian,Charles}

Functions converge on largest set in each class of sets

Page 16: Mathematics of incidence (part 2): formal concepts and formal concept lattices

Incidence relates power sets through functions

Charles DavidBrianAbby

Abby, Brian

Abby, Charles

Abby, David

Brian, Charles

Brian, David

Charles, David

Abby, Brian,

Charles

Abby, Brian, David

Brian, Charles,

David

Abby, Charles,

David

Abby, Brian,

Charles,David

eggsdoughnutscherriesbananasapples

apples, bananas

apples, cherries

apples,doughnuts

apples, eggs

bananas, cherries

bananas,doughnuts

bananas, eggs

cherries,doughnuts

cherries, eggs

doughnuts, eggs

apples, bananas, cherries

apples, bananas,

eggs

apples, bananas,

doughnuts

apples, cherries,

doughnuts

apples, cherries,

eggs

apples,doughnuts,

eggs

bananas, cherries,

doughnuts

bananas, cherries,

eggs

bananas,doughnuts,

eggs

cherries,doughnuts,

eggs

apples, bananas, cherries,

doughnuts

apples, bananas, cherries,

eggs

apples, bananas,

doughnuts, eggs

apples, cherries,

doughnuts, eggs

bananas, cherries,

doughnuts, eggs

apples, bananas, cherries,

doughnuts, eggs

Page 17: Mathematics of incidence (part 2): formal concepts and formal concept lattices

Functions give us closure operators

�( ({apples})) = {apples, bananas}�( ({apples, bananas})) = {apples, bananas}

(�({Abby})) = {Abby ,Brian,Charles} (�({Abby ,Brian,Charles})) = {Abby ,Brian,Charles}

Functions converge on largest set in each class of sets

Page 18: Mathematics of incidence (part 2): formal concepts and formal concept lattices

Formal concept

(A,B)

�(A) = B

(B) = A

A ✓ G B ✓ Mwhere andsatisfying

(A,B)For formal concept

A = ↵(A,B)

B = �(A,B)

is the extent of the conceptis the intent of the concept

Page 19: Mathematics of incidence (part 2): formal concepts and formal concept lattices

Formal concept construction

(I will just drop set notation for singleton sets)

�A = ( (�(A)),�(A))

µB = ( (B), (�(B)))

For arbitrary A ✓ G B ✓ Mand define

Like for biclique construction use closure

Page 20: Mathematics of incidence (part 2): formal concepts and formal concept lattices

Subconcepts

Subconcept order defined as for bicliques:

(A1, B1) � (A2, B2)

A1 ✓ A2

B1 ◆ B2

whenever

or, equivalently,

Page 21: Mathematics of incidence (part 2): formal concepts and formal concept lattices

Concept Lattice

({Abby,Brian,Charles,David},{bananas})

({Abby,Brian,Charles},{apples,bananas}) ({Brian, Charles, David},{bananas,doughnuts})

({Charles},{apples,bananas,cherries,doughnuts,eggs})

({Brian,Charles},{apples,bananas,cherries,doughnuts}) ({Charles, David},{bananas,doughnuts,eggs})

concept lattice is complete

Page 22: Mathematics of incidence (part 2): formal concepts and formal concept lattices

Lattice of bicliques/Concept lattice

Abby

Brian

Charles

David

apples

bananas

cherries

doughnuts

eggs

Abby

Brian

Charles

David

apples

bananas

cherries

doughnuts

eggs

Abby

Brian

Charles

David

apples

bananas

cherries

doughnuts

eggs

Abby

Brian

Charles

David

apples

bananas

cherries

doughnuts

eggs

Abby

Brian

Charles

David

apples

bananas

cherries

doughnuts

eggs

Abby

Brian

Charles

David

apples

bananas

cherries

doughnuts

eggs

({Abby,Brian,Charles,David},{bananas})

({Abby,Brian,Charles},{apples,bananas}) ({Brian, Charles, David},{bananas,doughnuts})

({Charles},{apples,bananas,cherries,doughnuts,eggs})

({Brian,Charles},{apples,bananas,cherries,doughnuts}) ({Charles, David},{bananas,doughnuts,eggs})

Page 23: Mathematics of incidence (part 2): formal concepts and formal concept lattices

Simplifying concept lattice

({Abby,Brian,Charles,David},{bananas})

({Abby,Brian,Charles},{apples,bananas}) ({Brian, Charles, David},{bananas,doughnuts})

({Charles},{apples,bananas,cherries,doughnuts,eggs})

({Brian,Charles},{apples,bananas,cherries,doughnuts}) ({Charles, David},{bananas,doughnuts,eggs})

label elements with µmm 2 M

�gg 2 G

if is conceptif is concept

µm

�g

everything aboveeverything below

includesg

m

includes

Page 24: Mathematics of incidence (part 2): formal concepts and formal concept lattices

Simplifying concept lattice

({Abby,Brian,Charles,David},{bananas})

({Abby,Brian,Charles},{apples,bananas}) ({Brian, Charles, David},{bananas,doughnuts})

({Charles},{apples,bananas,cherries,doughnuts,eggs})

({Brian,Charles},{apples,bananas,cherries,doughnuts}) ({Charles, David},{bananas,doughnuts,eggs})

label elements with µmm 2 M

�gg 2 G

if is conceptif is concept

Page 25: Mathematics of incidence (part 2): formal concepts and formal concept lattices

Simplified concept lattice

bananas

doughnutsapples

eggscherries

Charles

DavidBrian

Abby

Page 26: Mathematics of incidence (part 2): formal concepts and formal concept lattices

Definition: Lattice filters

A filter is an upward closed set for a set of elements

A principal filter is filter for a single element

Corresponds directly to simplified lattice labeling

"S = {p 2 L | s � p, 8s 2 S}

"s = {p 2 L | s � p}

"g = {p 2 L | �g � p}

Page 27: Mathematics of incidence (part 2): formal concepts and formal concept lattices

Principal Filters

bananas

doughnutsapples

eggscherries

Charles

DavidBrian

Abby

bananas

doughnutsapples

eggscherries

Charles

DavidBrian

Abby

bananas

doughnutsapples

eggscherries

Charles

DavidBrian

Abby

"Abby "Brian "Charles

Page 28: Mathematics of incidence (part 2): formal concepts and formal concept lattices

Defintion: Lattice ideals

A filter is an downward closed set for a set of elements

A principal ideal is ideal for a single element

Corresponds directly to simplified lattice labeling

#S = {p 2 L | p � s, 8s 2 S}

#s = {p 2 L | p � s}

#m = {p 2 L | p � µm}

Page 29: Mathematics of incidence (part 2): formal concepts and formal concept lattices

Principal Ideals

bananas

doughnutsapples

eggscherries

Charles

DavidBrian

Abby

bananas

doughnutsapples

eggscherries

Charles

DavidBrian

Abby

bananas

doughnutsapples

eggscherries

Charles

DavidBrian

Abby

#eggs #doughnuts #bananas

Page 30: Mathematics of incidence (part 2): formal concepts and formal concept lattices

Recall: recommendations

Abby

Brian

Charles

David

apples

bananas

cherries

doughnuts

eggs

Abby

Brian

Charles

David

apples

bananas

cherries

doughnuts

eggs

Abby

Brian

Charles

David

apples

bananas

cherries

doughnuts

eggs

Abby

Brian

Charles

David

apples

bananas

cherries

doughnuts

eggs

Abby

Brian

Charles

David

apples

bananas

cherries

doughnuts

eggs

Abby

Brian

Charles

David

apples

bananas

cherries

doughnuts

eggs

every biclique

above has Abby

every biclique below has doughnuts

Page 31: Mathematics of incidence (part 2): formal concepts and formal concept lattices

Recommendations, filters and ideals

• Can recommend to Abby by composing concepts from principal filter of Abby with concepts from principal ideal of doughnuts

• Principal ideal for doughnuts is maximal for foods (e.g., attributes) outside of Abby's filter

bananas

doughnutsapples

eggscherries

Charles

DavidBrian

Abby

"Abby

#doughnuts

Page 32: Mathematics of incidence (part 2): formal concepts and formal concept lattices

Questions linger:

• What is a "good" recommendation?

• Serendipity, who?

• And, what does the principal ideal for doughnuts have to do with the principal ideal for Abby? (Or, what is the deal with Abby and doughnuts?)

Page 33: Mathematics of incidence (part 2): formal concepts and formal concept lattices

ReadingB.A. Davey and H.A. Priestley, Introduction to Lattices and Order, Cambridge University Press, 2002

Covers posets and lattices in first two chapters, Formal Concept Analysis in the third chapter

B.Ganter and R.Wille, Formal Concept Analysis: Mathematical Foundations, Springer-Verlag, 1999

Harder to find mathematical reference on Formal Concept Analysis. Related material in Chapters 0 and 1

I skipped Galois connections, relates to the formal concept construction, both books cover those details

Page 34: Mathematics of incidence (part 2): formal concepts and formal concept lattices

About me and these slides

I am Ben(jamin) Keller. I learn and, sometimes, create through explaining. I had been involved in a big (US) federally funded project that had the goal of helping biomedical scientists tell stories about their experimental observations. The project is long gone, but I’m still trying to grok how such a thing would work. Much of biological data comes in the form of observations that are distilled to something that looks like an incidence relation, which brings us to this series of presentations. My goal for the slides is to deal with the mathematics and analysis of incidence in an approachable way, but the intuitive beginnings will eventually allow us to embrace the more complex later.

Page 35: Mathematics of incidence (part 2): formal concepts and formal concept lattices

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0

International License.