Merge: lib: introduce `fca` a module for formal concept analysis
authorJean Privat <jean@pryen.org>
Thu, 28 Sep 2017 23:39:24 +0000 (19:39 -0400)
committerJean Privat <jean@pryen.org>
Thu, 28 Sep 2017 23:39:24 +0000 (19:39 -0400)
## Building a FormalContext

We use the example from https://en.wikipedia.org/wiki/Formal_concept_analysis:

~~~nit
var fc = new FormalContext[Int, String]
fc.set_object_attributes(1, ["odd", "square"])
fc.set_object_attributes(2, ["even", "prime"])
fc.set_object_attributes(3, ["odd", "prime"])
fc.set_object_attributes(4, ["even", "composite", "square"])
fc.set_object_attributes(5, ["odd", "prime"])
fc.set_object_attributes(6, ["even", "composite"])
fc.set_object_attributes(7, ["odd", "prime"])
fc.set_object_attributes(8, ["even", "composite"])
fc.set_object_attributes(9, ["odd", "square", "composite"])
fc.set_object_attributes(10, ["even", "composite"])
~~~

## Computing the set of FormalConcept

~~~nit
var concepts = fc.formal_concepts
for concept in concepts do
print concept
end
~~~

## Visualizing formal concept with ConceptLattice

~~~nit
var cl = new ConceptLattice[Int, String].from_concepts(concepts)
cl.show_dot
~~~

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

Pull-Request: #2557
Reviewed-by: Jean Privat <jean@pryen.org>


Trivial merge