From: Jean Privat Date: Thu, 28 Sep 2017 23:39:24 +0000 (-0400) Subject: Merge: lib: introduce `fca` a module for formal concept analysis X-Git-Url: http://nitlanguage.org?hp=b808423d2a7940cda8f94aa633ceb3213ed4837e Merge: lib: introduce `fca` a module for formal concept analysis ## 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 Pull-Request: #2557 Reviewed-by: Jean Privat ---