<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Conexp-Clj - A Research Tool for FCA</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Tom Hanika</string-name>
          <email>tom.hanika@cs.uni-kassel.de</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Johannes Hirth</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Knowledge &amp; Data Engineering Group, University of Kassel</institution>
          ,
          <country country="DE">Germany</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>There is a plenitude of software programs to analyze data sets using notions from formal concept analysis (FCA). For example, there are 64 FCA related projects listed on GitHub. Those are developed in ten different programming languages and provide tools and libraries for computing formal concepts and alike. The research tool conexp-clj sticks out in this list. It is the only application in the FCA realm developed using the programming language Clojure, which is a modern, dynamic, and functional dialect of the Lisp programming language running on the Java platform. We summarize in this work the extensive set of notions from FCA that are covered by conexp-clj, show recent developments, present simple examples on a real world data set and depict a timeline for our next goals.</p>
      </abstract>
      <kwd-group>
        <kwd>Formal Concept Analysis</kwd>
        <kwd>Clojure</kwd>
        <kwd>Functional Programming</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>
        With the increase of computing power as well as its broad availability the field of
experimental mathematics [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ] has flourished in the last decades. This has led to the
development of uncountable many applications, libraries, and highly sophisticated
tools for computing in various realms of pure and applied mathematics. There are
at least two kinds of user for those: The first kind are users employing this kind of
software to other research fields, e.g., sociology, physics, or biology. The second kind
applies the developed algorithms and tools within the field they were developed in.
The goal here is to discover new insights and to advance the research field itself.
      </p>
      <p>Formal concept analysis (FCA) is no exception to this categorization. There is
a plenitude of tools for computing formal concepts, implications (functional
dependencies) in data, etc. Many tools are extensive in their features, but limit the user
through their user interfaces. Hence, formulating and expressing new ideas is bound
to the expressiveness of the particular interface. Furthermore, getting your own new
feature functions implemented and linked into the interface is costly and therefore
not common in the academic realm. The software conexp-clj,1 developed by Daniel
Borchmann as part of the DFG project (GA 216/10-1), aims in a different direction.</p>
      <p>Copyright c 2019 for this paper by its authors. Copying permitted for private and
academic purposes.
1 https://github.com/exot/conexp-clj
It embeds an extensive amount of FCA-functionality into a highly expressive
programming language – Clojure. In this work we demonstrate this expressiveness on a
real world data set and provide an overview about recent and future developments.</p>
    </sec>
    <sec id="sec-2">
      <title>Basic Usage of conexp-clj</title>
      <p>
        In this work we use notions from formal concept analysis (FCA) as introduced in [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ].
A formal context is a triple K = (G;M;I) with G being a set of object, M being a set of
attributes and I G M an incidence relation between them. For conexp-clj
usecases we often refer with the symbol ctx to a formal context and with the symbol cpt
to a formal concept. The declarative nature of functional programming languages,
like Clojure, makes the computation of FCA knowledge acquisition tasks intuitive
and adaptive. Being a Lisp dialect, Clojure uses prefix notation and puts statements
into parenthesis. Basic collections and their notation in Clojure are sets #{},
vectors [ ], lists ’( ), and hash-maps { }. To create a context in conexp-clj one
can use the make-context-from-matrix function, which creates a context from
a binary matrix. The function def assigns the context to the symbol ctx:
(def ctx (make-context-from-matrix
["platypus" "duck" "dog"]
["eggs" "mammal" "venomous"]
[1 1 1
1 0 0
0 1 0]))
      </p>
      <p>
        There are plenty of other ways to input formal contexts. For example, using its
incidence relation one can call (make-context #{1 2} #{1 2} #{[
        <xref ref-type="bibr" rid="ref11">1 1</xref>
        ] [
        <xref ref-type="bibr" rid="ref12">1 2</xref>
        ]}).
Furthermore, by providing a function f as incidence one can input a context
implicitly by (make-context objectset attributeset f), e.g., using the less
or equal comparability (make-context [1 2 3] [1 2 3] &lt;=). Note that Clojure
treats functions as first-class citizens, i.e., the language supports passing
functions as arguments to other functions. Following the functional paradigm, Clojure
functions are idempotent (often called pure) and return when called twice the
same output for a given input. The object/attribute set of a context ctx accessed
through (attributes ctx) and (objects ctx) respectively. For attributes we
call by (attribute-derivation ctx #{"mammal"}) the derivation operator and
by (context-attribute-clojure ctx #{"mammal"}) the closure operator. The
operators for objects are named accordingly. The set of all concepts can be
computed with (concepts ctx) and we obtain the canonical base (stem base) with
(canonical-base ctx). In terms of data exchange conexp-clj supports a variety
of file formats. Among those are Burmeister, FCAalgs, Colibri, Conexp, CSV, and
Galicia. In addition to binary contexts there is support for many-valued as well.
3
      </p>
    </sec>
    <sec id="sec-3">
      <title>Unique Feature Coverage</title>
      <p>Besides the choice of a functional, and therefore very expressive, programming
language, conexp-clj is equipped with abundance of features. This enables the</p>
      <p>Southern Woman: Stability vs Probability
Southern Woman Randomized: Stability vs Probability
1.0
y
i0.8
t
il
b
a
b0.6
o
r
P
t0.4
p
e
c
0.2
n
o
C
0.0
0.2</p>
      <sec id="sec-3-1">
        <title>Concept stability 0.8</title>
        <p>0.4 0.6
1.0
0.2</p>
      </sec>
      <sec id="sec-3-2">
        <title>C0.4oncept stability 0.8</title>
        <p>
          0.6
1.0
researcher to easily implement new ideas and to experiment on them. First of all,
conexp-clj tries to provide a diverse selection of algorithms for standard tasks like
computing the set of concepts. For example, computing the set of concepts is possible
through next closure [
          <xref ref-type="bibr" rid="ref5">5</xref>
          ], krajca [
          <xref ref-type="bibr" rid="ref10">10</xref>
          ], in-close [
          <xref ref-type="bibr" rid="ref1">1</xref>
          ], and others. Furthermore,
employing external binaries such as CbO or PCbO and interfacing with them is possible.
Interestingness of Concepts. There is a plenitude of measures to express how
interesting, relevant, useful or similar concepts or sets of concepts are in a formal
context. A good overview is presented in [
          <xref ref-type="bibr" rid="ref12">12</xref>
          ], from which the majority is
implemented in conexp-clj. For example, there is stability [
          <xref ref-type="bibr" rid="ref11">11</xref>
          ] of formal concepts. The
stability of a concept (A;B) indicates how likely B can be generated using uniformly
drawn object subsets from A. Another is robustness [
          <xref ref-type="bibr" rid="ref13">13</xref>
          ], which is a measures for
how likely a concept remains closed after removing an object from the concept’s
extent with probability 1 . A different approach is taken by concept probability [
          <xref ref-type="bibr" rid="ref9">9</xref>
          ]
that is the likelihood for an attribute set (object set) being closed. All those notions
can be computed in conexp-clj for any formal context ctx in the following way:
computes
computes
(concept-stability ctx cpt)
        </p>
        <p>computes
(concept-robustness cpt (concepts ctx) )
(concept-probability ctx cpt)
r(c = (A;B); ) =
d c</p>
        <p>Stab(A;B) = jfC AjC0=Bgj</p>
        <p>2jAj
( 1)jBdj jBcj(1</p>
        <p>)jAcj jAdj
n
p(B = B00) = k=0p(jB0j = k;B = B00)</p>
        <p>
          We may remark that conexp-clj also includes weighted similarity for
formal concepts. This function employs different measures for set similarity like the
Jaccard Index, the Sorensen coefficient or symmetric set difference.
Expressing New Ideas. In the following we demonstrate how novel ideas can
easily be expressed in conexp-clj. For this we compute two examples using the
well known Southern Woman data set [
          <xref ref-type="bibr" rid="ref14">14</xref>
          ]. The example computations were chosen
        </p>
        <p>Southern Woman Random
0.0
0.2 Relative Exten0.6t Size 0.8
0.4
1.0
0.0
0.2 Relative Exten0.6t Size 0.8
0.4
1.0
for our demonstration purpose only. We do not claim that there is deeper insight to
grasp from those. Imagine one wants to investigate possible correlations between the
probability and stability of a set of formal concepts in some formal context. This idea
can be expressed in simple terms using conexp-clj as shown below for context ctx:
(map (fn [x] [(concept-stability ctx x)</p>
        <p>(concept-probability ctx x)])
(concepts ctx)))</p>
        <p>
          This function call computes at first the set of all concepts for the given context.
Secondly, it maps the functions concept stability as well as the probability to the
beforehand computed formal concepts. Lastly, it returns a (lazy) list of
two-elementvectors which then can be plotted using a suitable tool. We depicted the results
in Figure 1, which does also include a plot for a random formal context which exhibits
the same statistical properties as the Southern Woman data set, i.e., number of
objects, number of attributes and density. The Clojure code shown above can be
incorporated in a new function by (defn somename [ctx] ...). Another idea could
be the investigation of the relation between the sizes of a concept’s intent and extent
for a given formal context ctx, as shown in the next code example, also see Figure 2:
(map (fn [x] [(/ (count (first x)) (count (objects ctx)))
(/ (count (second x)) (count (attributes ctx)))])
(concepts ctx)))
Probably Approximately Correct Methods. When applying classical
notions from FCA to large data sets one might encounter computationally infeasible
problems. To date there are two approaches to cope with this implemented in
conexp-clj. There is the probably approximately correct (PAC) canonical base, as
investigated in [
          <xref ref-type="bibr" rid="ref3">3</xref>
          ]. Furthermore, there is a PAC version of the classical exploration
algorithm present in the codebase of conexp-clj, which was introduced in [
          <xref ref-type="bibr" rid="ref4">4</xref>
          ].
Social Network Analysis and Graphs. Employing FCA for social network
analysis has found an increasing attention in the last decade. Hence, various notions
like average shortest path, average local clustering coefficient and degree distribution
were added recently to conexp-clj. More functionality is developed continuously.
4
        </p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>Outlook and Future Work</title>
      <p>
        We presented the research tool conexp-cljand its comprehensiveness. Yet, there are
many new features to come. For example, enhanced lattice diagram drawing through
novel developed algorithms, interfacing with Wikidata through the SPARQL
endpoint, motivated by [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ], and dimension reduction methods like attribute selection [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ].
      </p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>S.</given-names>
            <surname>Andrews</surname>
          </string-name>
          . “In-Close,
          <article-title>a Fast Algorithm for Computing Formal Concepts</article-title>
          .
          <source>” In: Proc. ICCS</source>
          <year>2009</year>
          . Ed. by Sebastian Rudolph, Frithjof Dau, and
          <string-name>
            <surname>Sergei</surname>
            <given-names>O.</given-names>
          </string-name>
          <string-name>
            <surname>Kuznetsov</surname>
          </string-name>
          . Vol.
          <volume>483</volume>
          . CEUR Workshop Proceedings. CEUR-WS.org,
          <year>2009</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>D. H.</given-names>
            <surname>Bailey</surname>
          </string-name>
          and
          <string-name>
            <given-names>J. M.</given-names>
            <surname>Borwein</surname>
          </string-name>
          . “
          <source>Experimental mathematics: Examples, methods and implications.” In: Notices of the AMS 52.5</source>
          (
          <issue>2005</issue>
          ), pp.
          <fpage>502</fpage>
          -
          <lpage>514</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>D.</given-names>
            <surname>Borchmann</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            <surname>Hanika</surname>
          </string-name>
          , and
          <string-name>
            <given-names>S.</given-names>
            <surname>Obiedkov</surname>
          </string-name>
          . “
          <article-title>On the Usability of Probably Approximately Correct Implication Bases</article-title>
          .” In: ICFCA. Ed. by
          <string-name>
            <given-names>K.</given-names>
            <surname>Bertet</surname>
          </string-name>
          et al. Vol.
          <volume>10308</volume>
          . Lecture Notes in Computer Science. Springer,
          <year>2017</year>
          , pp.
          <fpage>72</fpage>
          -
          <lpage>88</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>D.</given-names>
            <surname>Borchmann</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            <surname>Hanika</surname>
          </string-name>
          , and
          <string-name>
            <given-names>S.</given-names>
            <surname>Obiedkov</surname>
          </string-name>
          . “
          <article-title>Probably approximately correct learning of Horn envelopes from queries</article-title>
          .” In: Accepted for publication:
          <source>Journal Discrete Applied Mathematics abs/1807</source>
          .06149 (
          <year>2018</year>
          ).
          <article-title>Accepted for publication</article-title>
          :
          <source>Journal Discrete Applied Mathematics.</source>
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>B.</given-names>
            <surname>Ganter</surname>
          </string-name>
          . “
          <article-title>Two Basic Algorithms in Concept Analysis.” In: Formal Concept Analysis</article-title>
          . Ed. by Léonard Kwuida and
          <string-name>
            <given-names>Barış</given-names>
            <surname>Sertkaya</surname>
          </string-name>
          . Berlin, Heidelberg: Springer Berlin Heidelberg,
          <year>2010</year>
          , pp.
          <fpage>312</fpage>
          -
          <lpage>340</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>B.</given-names>
            <surname>Ganter</surname>
          </string-name>
          and
          <string-name>
            <given-names>R.</given-names>
            <surname>Wille</surname>
          </string-name>
          .
          <source>Formal Concept Analysis: Mathematical Foundations</source>
          . Springer-Verlag, Berlin,
          <year>1999</year>
          , pp.
          <source>x+284.</source>
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>T.</given-names>
            <surname>Hanika</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Koyda</surname>
          </string-name>
          , and
          <string-name>
            <surname>G. Stumme.</surname>
          </string-name>
          “Relevant Attributes in Formal Contexts.” In: Accepted for ICCS'
          <volume>19</volume>
          abs/
          <year>1812</year>
          .08868 (
          <year>2018</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>T.</given-names>
            <surname>Hanika</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Marx</surname>
          </string-name>
          , and
          <string-name>
            <given-names>G.</given-names>
            <surname>Stumme. Discovering Implicational</surname>
          </string-name>
          <article-title>Knowledge in Wikidata</article-title>
          . cite arxiv:
          <year>1902</year>
          .00916.
          <year>2019</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>M.</given-names>
            <surname>Klimushkin</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Obiedkov</surname>
          </string-name>
          , and
          <string-name>
            <given-names>C.</given-names>
            <surname>Roth</surname>
          </string-name>
          . “
          <article-title>Approaches to the Selection of Relevant Concepts in the Case of Noisy Data.” In: Formal Concept Analysis</article-title>
          . Ed. by Léonard Kwuida and
          <string-name>
            <given-names>Barış</given-names>
            <surname>Sertkaya</surname>
          </string-name>
          . Berlin, Heidelberg: Springer Berlin Heidelberg,
          <year>2010</year>
          , pp.
          <fpage>255</fpage>
          -
          <lpage>266</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>P.</given-names>
            <surname>Krajca</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Outrata</surname>
          </string-name>
          , and
          <string-name>
            <given-names>V.</given-names>
            <surname>Vychodil</surname>
          </string-name>
          . “
          <source>Parallel Recursive Algorithm for FCA.” In: Proc. CLA</source>
          <year>2008</year>
          . Ed. by Radim Belohlavek and
          <string-name>
            <given-names>Sergei O.</given-names>
            <surname>Kuznetsov</surname>
          </string-name>
          . Vol.
          <volume>433</volume>
          . CEUR Workshop Proceedings. CEUR-WS.org,
          <year>2008</year>
          , pp.
          <fpage>71</fpage>
          -
          <lpage>82</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <given-names>S. O.</given-names>
            <surname>Kuznetsov</surname>
          </string-name>
          . “
          <article-title>On stability of a formal concept</article-title>
          .”
          <source>In: Annals of Mathematics and Artificial Intelligence</source>
          <volume>49</volume>
          .1 (
          <issue>Apr</issue>
          .
          <year>2007</year>
          ), pp.
          <fpage>101</fpage>
          -
          <lpage>115</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <given-names>S.O.</given-names>
            <surname>Kuznetsov</surname>
          </string-name>
          and
          <string-name>
            <given-names>T.</given-names>
            <surname>Makhalova</surname>
          </string-name>
          . “
          <article-title>On interestingness measures of formal concepts</article-title>
          .
          <source>” In: Information Sciences 442-443</source>
          (
          <year>2018</year>
          ). Ed. by W. Pedrycz, p.
          <fpage>202</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [13]
          <string-name>
            <given-names>N.</given-names>
            <surname>Tatti</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Moerchen</surname>
          </string-name>
          , and
          <string-name>
            <given-names>T.</given-names>
            <surname>Calders</surname>
          </string-name>
          . “
          <source>Finding Robust Itemsets Under Subsampling.” In: ACM Trans. Database Syst</source>
          .
          <volume>39</volume>
          .3 (
          <issue>Oct</issue>
          .
          <year>2014</year>
          ),
          <volume>20</volume>
          :
          <fpage>1</fpage>
          -
          <lpage>20</lpage>
          :
          <fpage>27</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          [14]
          <string-name>
            <given-names>S.</given-names>
            <surname>Wasserman</surname>
          </string-name>
          and
          <string-name>
            <given-names>K.</given-names>
            <surname>Faust</surname>
          </string-name>
          .
          <article-title>Social Network Analysis. Methods and Applications. Structural Analysis in the Social Sciences</article-title>
          . New York, USA: Cambridge University Press,
          <year>1994</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>