Liking cljdoc? Tell your friends :D

API Documentation

Public API of conexp.base

Basic definitions for conexp-clj.

Available Functions

Function Documentation

Function <=>

Argument List: ([‍a b])

Documentation:

Implements equivalence.

Function =>

Argument List: ([‍a b])

Documentation:

Implements implication.

Function abs

Argument List: ([‍n])

Documentation:

(abs n) is the absolute value of n

Function all-closed-sets

Argument List: ([‍base clop] [‍base clop initial])

Documentation:

Computes all closed sets of a given closure operator on a given set. Uses initial as first closed set if supplied.

Function all-closed-sets-in-family

Argument List: ([‍predicate base clop] [‍predicate base clop initial])

Documentation:

Computes all closed sets of a given closure operator on a given set base contained in the family described by predicate. See documentation of next-closed-set-in-family for more details. Uses initial as first closed set if supplied.

Function ask

Argument List: ([‍prompt read & preds-and-fail-messages])

Documentation:

Performs simple quering. prompt is printed first and then the user is asked for an answer (via read). The other arguments are predicates with corresponding error messages. If a given answer does not satisfy some predicate pred, it's associated error message is printed (if it is a string) or it is assumed to be a function of one argument, whereupon it is called with the invalid answer and the result is printed. In any case, the user is asked again, until the given answer fulfills all given predicates.

Function ceil

Argument List: ([‍n])

Documentation:

(ceil n) returns the least integer greater than or equal to n. If n is an exact number, ceil returns an integer, otherwise a double.

Function clojure-type

Argument List: ([‍thing])

Documentation:

Dispatch function for multimethods.

Function compare-order

Argument List: ([‍x y])

Documentation:

Orders things for proper output of formal contexts.

Function conexp-version

Argument List: ([‍])

Documentation:

Returns the version of conexp as a string.

Function covers?

Argument List: ([‍sets base-set])

Documentation:

Technical Helper. Tests wheterh all elements in base-set are contained at least one set in sets.

Function cross-product

Argument List: ([‍& sets])

Documentation:

Returns cross product of set-1 and set-2.

Function def-

Argument List: ([‍name & decls])

Documentation:

Same as def, but yields a private definition

Function defalias

Argument List: ([‍name orig] [‍name orig doc])

Documentation:

Defines an alias for a var: a new var with the same root binding (if any) and similar metadata. The metadata of the alias is its initial metadata (as provided by def) merged into the metadata of the original.

Function defmacro-

Argument List: ([‍name & decls])

Documentation:

Same as defmacro but yields a private definition

Function die-with-error

Argument List: ([‍error strings])

Documentation:

Stops program by raising the given error with strings as message.

Function difference

Argument List: ([‍s1] [‍s1 s2] [‍s1 s2 & sets])

Documentation:

Return a set that is the first set without elements of the remaining sets

Function disjoint-union

Argument List: ([‍& sets])

Documentation:

Computes the disjoint union of sets by joining the cross-products of the sets with natural numbers.

Function distinct-by-key

Argument List: ([‍sequence key])

Documentation:

Returns a sequence of all elements of the given sequence with distinct key values, where key is a function from the elements of the given sequence. If two elements correspond to the same key, the one is chosen which appeared earlier in the sequence.

This function is copied from clojure.core/distinct and adapted for using a key function.

Function dopar

Argument List: ([‍[‍k v] & body])

Documentation:

Executes body binding k to each value in v. Execution is done in parallel. Code adapted from http://www.acooke.org/cute/Clojuremac0.html

Function ensure-length

Argument List: ([‍string length] [‍string length padding])

Documentation:

Fills given string with padding to have at least the given length.

Function ensure-seq

Argument List: ([‍x])

Documentation:

Given anything that can be made a sequence from, returns that sequence. If given a number x, returns (range x).

Function exact-integer-sqrt

Argument List: ([‍n])

Documentation:

(exact-integer-sqrt n) expects a non-negative integer n, and returns [s r] where n = s^2+r and n < (s+1)^2. In other words, it returns the floor of the square root and the 'remainder'. For example, (exact-integer-sqrt 15) is [3 6] because 15 = 3^2+6.

Function exists

Argument List: ([‍bindings condition])

Documentation:

Implements logical exists quantor. Bindings is of the form [var-1 seq-1 var-2 seq-2 ...]. Returns boolean value.

Function expand-bindings

Argument List: ([‍bindings body])

Documentation:

Expands bindings used by forall and exists.

Function expt

Argument List: ([‍a b])

Documentation:

Exponentiation of arguments. Is exact if given arguments are exact and returns double otherwise.

Function first-non-nil

Argument List: ([‍seq])

Documentation:

Returns first non-nil element in seq, or nil if there is none.

Function first-position-if

Argument List: ([‍predicate sequence])

Documentation:

Return the index of the first element in sequence for which predicate returns true.

Function floor

Argument List: ([‍n])

Documentation:

(floor n) returns the greatest integer less than or equal to n. If n is an exact number, floor returns an integer, otherwise a double.

Function forall

Argument List: ([‍bindings condition])

Documentation:

Implements logical forall quantor. Bindings is of the form [var-1 seq-1 var-2 seq-2 ...]. Returns boolean value.

Function gcd

Argument List: ([‍a b])

Documentation:

(gcd a b) returns the greatest common divisor of a and b

Function generic-equals

Argument List: ([‍[‍this other] class fields])

Documentation:

Implements a generic equals for class on fields.

Function graph-of-function?

Argument List: ([‍relation source target])

Documentation:

Returns true iff relation is the graph of a function from source to target.

Function has-version?

Argument List: ([‍{my-major :major, my-minor :minor, my-patch :patch}])

Documentation:

Compares given version of conexp and returns true if and only if the current version of conexp is higher or equal than the given one

Function hash-combine-hash

Argument List: ([‍& args])

Documentation:

Combines the hashes of all things given.

Function illegal-argument

Argument List: ([‍& strings])

Documentation:

Throws IllegalArgumentException with given strings as message.

Function illegal-state

Argument List: ([‍& strings])

Documentation:

Throws IllegalStateException with given strings as message.

Function immigrate

Argument List: ([‍& ns-names])

Documentation:

Create a public var in this namespace for each public var in the namespaces named by ns-names. The created vars have the same name, root binding, and metadata as the original except that their :ns metadata value is this namespace.

This function is literally copied from the clojure.contrib.ns-utils library.

Function improve-basic-order

Argument List: ([‍base clop])

Documentation:

Improves basic order on the sequence base, where the closure operator clop operates on.

Function index

Argument List: ([‍xrel ks])

Documentation:

Returns a map of the distinct values of ks in the xrel mapped to a set of the maps in xrel with the corresponding values of ks.

Function inits

Argument List: ([‍sqn])

Documentation:

Returns a lazy sequence of the beginnings of sqn.

Function integer-length

Argument List: ([‍n])

Documentation:

Length of integer in binary

Function intersection

Argument List: ([‍s1] [‍s1 s2] [‍s1 s2 & sets])

Documentation:

Return a set that is the intersection of the input sets

Function intersection-set?

Argument List: ([‍set sets])

Documentation:

Tests whether set has non-empty intersection with every set in sets.

Function join

Argument List: ([‍xrel yrel] [‍xrel yrel km])

Documentation:

When passed 2 rels, returns the rel corresponding to the natural join. When passed an additional keymap, joins on the corresponding keys.

Function lcm

Argument List: ([‍a b])

Documentation:

(lcm a b) returns the least common multiple of a and b

Function lectic-<

Argument List: ([‍base A B])

Documentation:

Implements lectic ordering. The basic order is given by the ordering of base which is interpreted as increasing order.

Function lectic-<_i

Argument List: ([‍base i A B])

Documentation:

Implements lectic < at position i. The basic order is given by the ordering of base which is interpreted as increasing order.

A and B have to be sets.

Function map-by-fn

Argument List: ([‍function keys])

Documentation:

Returns a hash map with the values of keys as keys and their values under function as values.

Function map-invert

Argument List: ([‍m])

Documentation:

Returns the map with the vals mapped to the keys.

Function memo-fn

Argument List: ([‍name args & body])

Documentation:

Defines memoized, anonymous function.

Function minimal-generating-subsets

Argument List: ([‍clop A])

Documentation:

Given a set A and a closure operator clop returns all subsets B of A such that (= (clop A) (clop B)).

Function minimal-hypergraph-transversals

Argument List: ([‍vertices edges])

Documentation:

Returns all minimal hypergraph transversals of the hypergraph defined by «edges» on the vertex sets «vertices».

Function minimum-set-covers

Argument List: ([‍base-set sets])

Documentation:

For a given set base-set and a collection of sets returns all subcollections of sets such that the union of the contained sets cover base-set and that are minimal with that property.

Function next-closed-set

Argument List: ([‍base clop A])

Documentation:

Computes next closed set of the closure operator clop after A with the Next Closure algorithm. The order of elements in base, interpreted as increasing, is taken to be the basic order of the elements.

Function next-closed-set-in-family

Argument List: ([‍predicate base clop A])

Documentation:

Computes next closed set as with next-closed-set, which is in the family F of all closed sets satisfing predicate. predicate has to satisfy the condition

A in F and i in base ==> clop(A union {1, ..., i-1}) in F.

Function not-yet-implemented

Argument List: ([‍])

Documentation:

Throws UnsupportedOperationException with "Not yet implemented" message.

Function now

Argument List: ([‍])

Documentation:

Returns the current time in a human readable format.

Function order-by

Argument List: ([‍sequence])

Documentation:

Returns a function on two arguments a and b that returns true if and only if b occurs not after a in the given sequence (ascending order.)

Function parallel-closures

Argument List: ([‍base clop])

Documentation:

Returns the set of all closures of the closure operator on the given base set. Computes the closures in parallel, to the extent possible.

Function partial-max

Argument List: ([‍<= xs])

Documentation:

For a given partial order <= and given elements returns the maximal among them.

Function partial-min

Argument List: ([‍<= xs])

Documentation:

For a given partial order <= and given elements returns the minimal among them.

Function prod

Argument List: ([‍index start end & expr])

Documentation:

Computes the product of expr for indices from start to end, named as index.

Function project

Argument List: ([‍xrel ks])

Documentation:

Returns a rel of the elements of xrel with only the keys in ks

Function proper-subset?

Argument List: ([‍set-1 set-2])

Documentation:

Returns true iff set-1 is a proper subset of set-2.

Function proper-superset?

Argument List: ([‍set-1 set-2])

Documentation:

Returns true iff set-1 is a proper superset of set-2.

Function quit

Argument List: ([‍])

Documentation:

Quits conexp-clj.

Function reduce!

Argument List: ([‍fn initial-value coll])

Documentation:

Does the same as reduce, but calls transient on the initial value and persistent! on the result.

Function redundant?

Argument List: ([‍base-set cover count])

Documentation:

Technical Helper. For a given set base-set, a collection cover of sets and a map mapping elements from base-set to the number of times they occur in sets in cover, tests whether the cover is redundant or not, i.e. if a proper subcollection of cover is already a cover or not.

Function reflexive-transitive-closure

Argument List: ([‍base-set pairs])

Documentation:

Computes the reflexive, transitive closure of a given set of pairs on base-set.

Function rename

Argument List: ([‍xrel kmap])

Documentation:

Returns a rel of the maps in xrel with the keys in kmap renamed to the vals in kmap

Function rename-keys

Argument List: ([‍map kmap])

Documentation:

Returns the map with the keys in kmap renamed to the vals in kmap

Function round

Argument List: ([‍n])

Documentation:

(round n) rounds to the nearest integer. round always returns an integer. Rounds up for values exactly in between two integers.

Function select

Argument List: ([‍pred xset])

Documentation:

Returns a set of the elements for which pred is true

Function set-of

Argument List: ([‍thing & condition])

Documentation:

Macro for writing sets as mathematicians do (at least similar to it.) The following syntax constructions are supported:

(set-of x [x [1 2 3]])
  for the set of all x with x in [1 2 3]

(set-of x | x [1 2 3])
  for the same set

(set-of [x y] [x [1 2 3], y [4 5 6] :when (= 1 (gcd x y))])
  for the set of all pairs [x y] with x in [1 2 3], y in [4 5 6]
  and x and y are coprime.

In general, the condition vector (or the sequence after |) must be suitable for doseq.

Function set-of-range

Argument List: ([‍end] [‍start end] [‍start end step])

Documentation:

Returns a set of all numbers from start upto (but not including) end, by step if provided.

Function singleton?

Argument List: ([‍x])

Documentation:

Returns true iff given thing is a singleton sequence or set.

Function sort-by-first

Argument List: ([‍x y])

Documentation:

Ensures that pairs are ordered by first entry first.

Function sort-by-second

Argument List: ([‍x y])

Documentation:

Ensures that pairs are ordered by second entry first. This gives better output for context sums, products, ...

Function split-at-first

Argument List: ([‍predicate sequence])

Documentation:

Splits given sequence at first element satisfing predicate. The first element satisfing predicate will be in the second sequence.

Function split-at-last

Argument List: ([‍predicate sequence])

Documentation:

Splits given sequence at last element satisfing predicate. The last element satisfing predicate will be in the first sequence.

Function sqrt

Argument List: ([‍n])

Documentation:

Square root, but returns exact number if possible.

Function subset?

Argument List: ([‍set1 set2])

Documentation:

Is set1 a subset of set2?

Function subsets

Argument List: ([‍base-set])

Documentation:

Returns all subsets of the given base-set.

Function sum

Argument List: ([‍index start end & expr])

Documentation:

Computes the sum of expr for indices from start to end, named as index.

Function superset?

Argument List: ([‍set1 set2])

Documentation:

Is set1 a superset of set2?

Function tails

Argument List: ([‍sqn])

Documentation:

Returns a lazy sequence of the tails of sqn.

Function to-set

Argument List: ([‍thing])

Documentation:

Converts given argument «thing» to a set. If it is a number, returns the set {0, ..., thing-1}. If it is a collection, returns (set thing). Otherwise raises an error.

Function topological-sort

Argument List: ([‍comp coll])

Documentation:

Returns a linear extension of the given collection coll and the supplied comparator comp.

Function transitive-closure

Argument List: ([‍pairs])

Documentation:

Computes transitive closure of a given set of pairs.

Function transitive-reduction

Argument List: ([‍pairs] [‍base pred])

Documentation:

Returns for a set of pairs its transitive reduction. Alternatively, the relation can be given as a base set and a predicate p which returns true in (p x y) iff [x y] is in the relation in question.

Note that if the relation given is not acyclic, the transitive closure of the reduction may not yield the transitive closure of the original relation anymore, since the reduction itself can be empty.

Function union

Argument List: ([‍] [‍s1] [‍s1 s2] [‍s1 s2 & sets])

Documentation:

Return a set that is the union of the input sets

Function unsupported-operation

Argument List: ([‍& strings])

Documentation:

Throws UnsupportedOperationException with given strings as message.

Function warn

Argument List: ([‍message])

Documentation:

Emits a warning message on out.

Function with-altered-vars

Argument List: ([‍bindings & body])

Documentation:

Executes the code given in a dynamic environment where the var roots of the given names are altered according to the given bindings. The bindings have the form [name_1 f_1 name_2 f_2 ...] where f_i is applied to the original value of the var associated with name_i to give the new value which will be in place during execution of body. The old value will be restored after execution has been finished.

Function with-memoized-fns

Argument List: ([‍functions & body])

Documentation:

Runs code in body with all given functions memoized.

Function with-printed-result

Argument List: ([‍string & body])

Documentation:

Prints string followed by result, returning it.

Function with-str-out

Argument List: ([‍& body])

Documentation:

Returns string of all output being made in (flatten body).

Function with-testing-data

Argument List: ([‍bindings & body])

Documentation:

Expects for all bindings the body to be evaluated to true. bindings must be those of doseq.

Function with-var-bindings

Argument List: ([‍bindings & body])

Documentation:

Executes body with the vars in bindings set to the corresponding values.

Function yes-or-no?

Argument List: ([‍question])

Documentation:

Asks string, expecting 'yes' or 'no'. Returns true when answered 'yes' and false otherwise.

Function zip

Argument List: ([‍seq-1 seq-2])

Documentation:

Returns sequence of pairs [x,y] where x runs through seq-1 and y runs through seq-2 simultaneously. This is the same as (map #(vector %1 %2) seq-1 seq-2).

Public API of conexp.fca.contexts

Provides the implementation of formal contexts and functions on them.

Available Functions

Function Documentation

Function ->Formal-Context

Argument List: ([‍objects attributes incidence])

Documentation:

Positional factory function for class conexp.fca.contexts.Formal-Context.

Function adiag-context

Argument List: ([‍base-set])

Documentation:

Returns not= on base-set as context.

Function adprime

Argument List: ([‍ctx set-of-attributes])

Documentation:

Computes double prime in context ctx for the given set-of-attributes.

Function aprime

Argument List: ([‍ctx attributes])

Documentation:

Computes set of objects common to all attributes in context.

Function attribute-clarified?

Argument List: ([‍ctx])

Documentation:

Tests whether given context ctx is attribute clarified.

Function attribute-concept

Argument List: ([‍ctx m])

Documentation:

Returns the attribute concept of the given attribute m in context ctx.

Function attribute-derivation

Argument List: ([‍ctx attributes])

Documentation:

Computes set of objects common to all attributes in context.

Function attribute-reduced?

Argument List: ([‍ctx])

Documentation:

Tests whether given context ctx is attribute-reduced or not.

Function attributes

Argument List: ([‍ctx])

Documentation:

Returns the attributes of a context.

Function cbo-test

Argument List: ([‍attribute j B D])

Documentation:

Simple implementation of the test used by the «Close by One» algorithm.

Function clarify-attributes

Argument List: ([‍ctx])

Documentation:

Clarifies attributes in context ctx.

Function clarify-context

Argument List: ([‍ctx])

Documentation:

Clarifies context ctx.

Function clarify-objects

Argument List: ([‍ctx])

Documentation:

Clarifies objects in context ctx.

Function compatible-subcontext?

Argument List: ([‍ctx-1 ctx-2])

Documentation:

Tests whether ctx-1 is a compatible subcontext of ctx-2.

Function compatible-subcontexts

Argument List: ([‍ctx])

Documentation:

Returns all compatible subcontexts of ctx. ctx has to be reduced.

Function concept?

Argument List: ([‍ctx [‍set-of-obj set-of-att]])

Documentation:

Tests whether given pair is a concept in context ctx.

Function concepts

Argument List: ([‍ctx])

Documentation:

Returns a sequence of all concepts of ctx.

Function context-apposition

Argument List: ([‍ctx-1 ctx-2])

Documentation:

Returns context apposition of ctx-1 and ctx-2, that is

(G_1,M_1,I_1) | (G_1,M_2,I_2) := (G_1,M_1 dunion M_2,I_1 dunion I_2).

Function context-attribute-closure

Argument List: ([‍ctx set-of-attributes])

Documentation:

Computes double prime in context ctx for the given set-of-attributes.

Function context-clarified?

Argument List: ([‍ctx])

Documentation:

Tests whether given context ctx is clarified.

Function context-composition

Argument List: ([‍ctx-1 ctx-2])

Documentation:

Returns context composition of ctx-1 and ctx-2, that is

(G_1,M_1,I_1) o (G_2,M_2,I_2) := (G_1,M_2,I_1 o I_2).

Function context-disjoint-union

Argument List: ([‍ctx-1 ctx-2])

Documentation:

Returns the disjoint union of ctx-1 and ctx-2.

Function context-intersection

Argument List: ([‍ctx1 ctx2])

Documentation:

Returns context intersection of ctx1 and ctx2.

Function context-object-closure

Argument List: ([‍ctx set-of-objects])

Documentation:

Computes double prime in context ctx for the given set-of-objects.

Function context-product

Argument List: ([‍ctx-1 ctx-2])

Documentation:

Computes the context product of ctx-1 and ctx-2, that is

(G_1,M_1,I_1) x (G_2,M_2,I_2) :=
  (G_1 x G_2, M_1 x M_2, nabla)

where

(g_1,g_2) nabla (m_1,m_2) <=> g_1I_1m_1 or g_2I_2m_2.

Function context-reduced?

Argument List: ([‍ctx])

Documentation:

Tests whether given context ctx is reduced or not.

Function context-semiproduct

Argument List: ([‍ctx-1 ctx-2])

Documentation:

Computes the context semiproduct of ctx-1 and ctx-2, where for contexts (G_1,M_1,I_1) and (G_2,M_2,I_2) their semidirect product is defined as

(G_1 x G_2, M_1 dunion M_2, nabla)

where

(g_1,g_2) nabla (j,m) <=> g_jI_jm for j in {1,2}.

Function context-size

Argument List: ([‍ctx])

Documentation:

Returns tuple of number of objects, number of attributes, and fill rate.

Function context-subposition

Argument List: ([‍ctx-1 ctx-2])

Documentation:

Returns context subposition of ctx-1 and ctx-2, that is

 (G_1,M_1,I_1)
--------------- := (G_1 dunion G_2, M_1, I_1 union I_2).
 (G_2,M_1,I_2)

Function context-sum

Argument List: ([‍ctx-1 ctx-2])

Documentation:

Computes the context sum of ctx-1 and ctx-2, that is

(G_1,M_1,I_1) + (G_2,M_2,I_2) :=
  (G_1 dunion G_2, M_1 dunion M_2, I_1 dunion I_2
   dunion (G_1 x M_2) dunion (G_2 x M_1))

where all set unions are disjoint set unions.

Function context-to-string

Argument List: ([‍ctx] [‍ctx order-on-objects order-on-attributes])

Documentation:

Prints contexts in a human readable form. Orderings can be given as sequences or as functions. If given as sequence, the corresponding elements will be ordered that way, with all remaining elements at the end. If given as function, sort the corresponding elements with that function. If no ordering is given for objects and attributes, sort-by-second is used.

Function context-transitive-closure

Argument List: ([‍ctx])

Documentation:

Transitively closes incidence relation of ctx and returns corresponding context.

Function context-union

Argument List: ([‍ctx-1 ctx-2])

Documentation:

Returns the union of ctx-1 and ctx-2. Note that this union is inclusive; use context-disjoint-union if this is not what you want.

Function context-xia-product

Argument List: ([‍ctx-1 ctx-2])

Documentation:

Computes Xia's product of ctx-1 and ctx-2, where for two contexts (G_1,M_1,I_1) and (G_2,M_2,I_2) their Xia product is defined as

(G_1 x G_2, M_1 x M_2, ~)

where

(g_1,g_2) ~ (m_1,m_2) <=> (g_1I_1m_1 <=> g_2I_2m_2).

Function context?

Argument List: ([‍thing])

Documentation:

Returns true iff thing is a formal context.

Function diag-context

Argument List: ([‍base-set])

Documentation:

Returns = on base-set as context.

Function direct-lower-concepts

Argument List: ([‍ctx [‍A B]])

Documentation:

Computes the set of direct upper neighbours of the concept [A B] in the concept lattice of ctx. Uses Lindig's Algorithm for that.

Function direct-upper-concepts

Argument List: ([‍ctx [‍A B]])

Documentation:

Computes the set of direct upper neighbours of the concept [A B] in the concept lattice of ctx. Uses Lindig's Algorithm for that.

Function down-arrows

Argument List: ([‍ctx])

Documentation:

Computes the down arrow relation of ctx.

Function dual-context

Argument List: ([‍ctx])

Documentation:

Dualizes context ctx, that is (G,M,I) gets (M,G,I^{-1}).

Function extent?

Argument List: ([‍ctx thing])

Documentation:

Test whether thing' is an extent of the formal contextctx.'

Function extents

Argument List: ([‍ctx] [‍ctx pred])

Documentation:

Computes a sequence of all extents of «ctx», in a lectic order. Optionally, one can specify a predicate function «pred» that acts as a filter on all extents of «ctx». «pred» should specify the same conditions as the predicate function to «next-closed-set-in-family».

Function incidence

Argument List: ([‍ctx])

Documentation:

Returns a function that, given a pair [a b], returns true if and only if a and b are incident in the context ctx.

Function incidence-relation

Argument List: ([‍ctx])

Documentation:

Returns the incidence-relation of the given context, as a set of pairs of objects and attributes.

Function incident?

Argument List: ([‍ctx g m])

Documentation:

Returns true if and only if in context ctx, the object g is incident with the attribute m.

Function intent?

Argument List: ([‍ctx thing])

Documentation:

Test whether thing' is an intent of the formal contextctx.'

Function intents

Argument List: ([‍ctx] [‍ctx pred])

Documentation:

Computes a sequence of all intents of «ctx», in a lectic order. Optionally, one can specify a predicate function «pred» that acts as a filter on all intents of «ctx». «pred» should specify the same conditions as the predicate function to «next-closed-set-in-family».

Function invert-context

Argument List: ([‍ctx])

Documentation:

Inverts context ctx, that is (G,M,I) gets (G,M,(G x M) \ I).

Function make-context

Argument List: ([‍objects attributes incidence])

Documentation:

Standard constructor for contexts. Takes a sequence of objects, a sequence of attributes and either a set of pairs or function of two arguments being true iff its arguments are incident. Note that the object and attribute sequences are converted to sets and therefore have to not contain any duplicate elements. If the incidence relation is given as a sequence, it is automatically restricted to the cartesian product of the object an the attribute set.

Function make-context-from-matrix

Argument List: ([‍G M bits])

Documentation:

Given objects G and attribute M and an incidence matrix constructs the corresponding context. G and M may also be numbers where they represent (range G) and (range M) respectively.

Function make-context-nc

Argument List: ([‍objects attributes incidence])

Documentation:

Context constructor similar to make-context, but does not do any safety checking and is therefore faster. Use with care.

This function is useful if you want to construct new contexts from old ones. In particular, if you want to use the incidence relation if a given context as the incidence relation for a new one, you can just pass it to this function without any modifications.

Function null-context

Argument List: ([‍base-set])

Documentation:

Returns context with no crosses.

Function object-clarified?

Argument List: ([‍ctx])

Documentation:

Tests whether given context ctx is object clarified.

Function object-concept

Argument List: ([‍ctx g])

Documentation:

Returns the object concept of the given object g in context ctx.

Function object-derivation

Argument List: ([‍ctx objects])

Documentation:

Computes set of attributes common to all objects in context.

Function object-reduced?

Argument List: ([‍ctx])

Documentation:

Tests whether given context ctx is object-reduced or not.

Function objects

Argument List: ([‍ctx])

Documentation:

Returns the objects of a context.

Function odprime

Argument List: ([‍ctx set-of-objects])

Documentation:

Computes double prime in context ctx for the given set-of-objects.

Function one-context

Argument List: ([‍base-set])

Documentation:

Returns context full of crosses.

Function oprime

Argument List: ([‍ctx objects])

Documentation:

Computes set of attributes common to all objects in context.

Function print-context

Argument List: ([‍ctx & args])

Documentation:

Prints the result of applying context-to-string to the given arguments.

Function rand-context

Argument List: ([‍base-set fill-rate] [‍objects attributes fill-rate])

Documentation:

Randomly fills context on base-set (or on objects and attributes) with crosses and propability fill-rate. If given numbers instead of collections uses (range base-set) (and likewise for objects and attributes) instead.

Function random-context

Argument List: ([‍base-set fill-rate] [‍objects attributes fill-rate])

Documentation:

Randomly fills context on base-set (or on objects and attributes) with crosses and propability fill-rate. If given numbers instead of collections uses (range base-set) (and likewise for objects and attributes) instead.

Function random-contexts

Argument List: ([‍number upper-limit])

Documentation:

Returns a sequence of number contexts, with random fill rate and random size between 0 and upper-limit.

Function reduce-attributes

Argument List: ([‍ctx])

Documentation:

Attribute reduction for ctx.

Function reduce-context

Argument List: ([‍ctx])

Documentation:

Reduces context ctx.

Function reduce-objects

Argument List: ([‍ctx])

Documentation:

Object reduction for ctx.

Function rename-attributes

Argument List: ([‍ctx old-to-new])

Documentation:

Rename attributes in ctx by given function old-to-new.

Function rename-objects

Argument List: ([‍ctx old-to-new])

Documentation:

Rename objects in ctx by given function old-to-new.

Function restrict-concept

Argument List: ([‍concept subcontext])

Documentation:

Restricts the given concept to the given subcontext.

Function subconcept?

Argument List: ([‍a b])

Documentation:

Tests if 'a is a subset of 'b, but not equal.

Function subconceptneq?

Argument List: ([‍a b])

Documentation:

Tests if 'a is a subset of 'b, but not equal.

Function subcontext?

Argument List: ([‍ctx-1 ctx-2])

Documentation:

Tests whether ctx-1 is a subcontext ctx-2 or not.

Function up-arrows

Argument List: ([‍ctx])

Documentation:

Computes the up arrow relation of ctx.

Function up-down-arrows

Argument List: ([‍ctx])

Documentation:

Returns up-down-arrow relation of ctx.

Public API of conexp.fca.many-valued-contexts

Many-Valued-Contexts and some functions for scaling.

Available Functions

Function Documentation

Function ->Many-Valued-Context

Argument List: ([‍objects attributes incidence])

Documentation:

Positional factory function for class conexp.fca.many_valued_contexts.Many-Valued-Context.

Function biordinal-scale

Argument List: ([‍values n] [‍values others n <= >=])

Documentation:

Returns the biordinal scale on the sequence values, optionally given two order relations <= and >=. Note that values (and others) must be ordered (e.g. vector or list), because otherwise the result will be arbitrary.

Function dichotomic-scale

Argument List: ([‍values])

Documentation:

Returns the dichotimic scale on the set values. Note that base must have exactly two arguments.

Function incidences-of-object

Argument List: ([‍mv-ctx g])

Documentation:

For a given many-valued context mv-ctx and a given object g, returns the set of all values of g in mv-ctx.

Function interordinal-scale

Argument List: ([‍values] [‍values <= >=] [‍values others <= >=])

Documentation:

Returns the interordinal scale on the set base, optionally given two order relations <= and >=.

Function interval-scale

Argument List: ([‍values] [‍values others] [‍values others < >=])

Documentation:

Returns the interval scale on the set values. Note that values must be ordered (e.g. vector or list), because otherwise the result will be arbitrary. Also note that the intervales will be left-open.

Function make-mv-context

Argument List: ([‍objects attributes incidence])

Documentation:

Constructs a many-valued context from a set of objects, a set of attributes and an incidence relation, given as set of triples [g m w] or as a function from two arguments g and m to values w.

Function make-mv-context-from-matrix

Argument List: ([‍objects attributes values])

Documentation:

Creates a many-valued context from a given matrix of values. objects and attributes may either be given as numbers representing the corresponding number of objects and attributes respectively, or as collections. The number of entries in values must match the number of objects times the number of attributes.

Function make-mv-context-nc

Argument List: ([‍objects attributes incidence])

Documentation:

Just creates a many-valued context from a set of objects, a set of attributes and a hashmap from pairs of objects and attributes to values. Does no checking, use with care.

Function make-mv-subcontext

Argument List: ([‍mv-ctx objs attrs])

Documentation:

For a given many-valued context, returns the induced subcontext given by the object and attribute set.

Function mv-context-to-string

Argument List: ([‍mv-ctx] [‍mv-ctx order-on-objects order-on-attributes])

Documentation:

Returns a string representing the given many-valued context mv-ctx as a value-table.

Function nominal-scale

Argument List: ([‍values] [‍values others])

Documentation:

Returns the nominal scale on the set base.

Function object-by-incidence

Argument List: ([‍mv-ctx values])

Documentation:

For a given many-valued context mv-ctx and an attribute-value map, returns all objects having these values.

Function ordinal-scale

Argument List: ([‍values] [‍values <=] [‍values others <=])

Documentation:

Returns the ordinal scale on the set values, optionally given an order relation <=.

Function scale-mv-context

Argument List: ([‍mv-ctx scales] [‍mv-ctx scales default])

Documentation:

Scales given many-valued context mv-ctx with given scales. scales must be a map from attributes m to contexts K, where all possible values of m in mv-ctx are among the objects in K. If a scale for an attribute is given, the default scale is used, where default should be a function returning a scale for the supplied attribute. If no default scale is given, an error is thrown if an attribute is missing.

Function scale-mv-context-with

Argument List: ([‍ctx & scales])

Documentation:

Scales the given many-valued context ctx with the given scales. These are of the form

[att_1 att_2 ...] scale,

where att_i is an attribute of the given context and scale determines a call to a known scale. The variable «values» will be bound to the corresponding values of each attribute and may be used when constructing the scale. For example, you may use this macro with

(scale-mv-context-with ctx
  [a b c]  (nominal-scale values)
  [d]      (ordinal-scale values <=)
  (nominal-scale values))

where the last entry (without any associated attribute) is the default scale. Note that attributes of ctx always have to be given in a sequence, even if there is only one.

Function values-of-attribute

Argument List: ([‍mv-ctx m])

Documentation:

For a given many-valued context mv-ctx and a given attribute m, returns the set of all values of m in mv-ctx.

Function values-of-object

Argument List: ([‍mv-ctx g])

Documentation:

For a given many-valued context mv-ctx and a given object g, returns the set of all values of g in mv-ctx.

Public API of conexp.fca.implications

Implications for Formal Concept Analysis.

Available Functions

Function Documentation

Function ->Implication

Argument List: ([‍premise conclusion])

Documentation:

Positional factory function for class conexp.fca.implications.Implication.

Function add-immediate-elements

Argument List: ([‍implications initial-set subset-test])

Documentation:

Iterating through the sequence of implications, tries to apply as many implications as possible. Uses subset-test to determine whether a given implication can be used to extend a given set, i.e. an implication impl can be used to extend a set s if and only if

(subset-test (premise impl) s)

is true. Note that if (conclusion impl) is already a subset of s, then s is effectively not extended.

Function approx-canonical-base

Argument List: ([‍ctx ε δ])

Documentation:

Compute a set L of implications that is an approximation to the canonical base of the formal context `ctx'. More precisely, if H is the canonical base of ctx, then

|Mod(L) Δ Mod(H)|/2^{|M|} ≤ ε

with probability at least 1-δ. The computation is done in polynomial time with respect to |M|, |L|, 1/ε, and 1/δ.

Function association-rules

Argument List: ([‍context minsupp minconf])

Documentation:

Returns all association rules of context with the parameters minsupp as minimal support and minconf as minimal confidence. The result returned is a lazy sequence.

Function canonical-base

Argument List: ([‍ctx] [‍ctx background-knowledge] [‍ctx background-knowledge predicate])

Documentation:

Returns the canonical base of given context, as a lazy sequence. Uses «background-knowledge» as starting set of implications, which will not appear in the result. If «predicate» is given (a function), computes only those implications from the canonical base whose premise satisfy this predicate, i.e. «predicate» returns true on these premises. Note that «predicate» has to satisfy the same conditions as the predicate to «next-closed-set-in-family».

Function canonical-base-from-base

Argument List: ([‍implications])

Documentation:

For a given set of implications returns its stem-base.

Function canonical-base-from-clop

Argument List: ([‍clop base] [‍clop base background-knowledge] [‍clop base background-knowledge predicate])

Documentation:

Given a closure operator «clop» on the set «base», computes its canonical base, optionally using the set «background-knowledge» of implications on «base-set» as background knowledge. The result will be a lazy sequence. If «predicate» is given as third argument, computes only those implications whose premise satisfy this predicate. Note that «predicate» has to satisfy the same conditions as the one of «next-closed-set-in-family».

Function clop-by-implications

Argument List: ([‍implications])

Documentation:

Returns closure operator given by implications.

Function close-under-implications

Argument List: ([‍implications input-set])

Documentation:

Computes smallest superset of set being closed under given implications.

Function close-with-downing-gallier

Argument List: ([‍[‍implications in-premise numargs] input-set])

Documentation:

Downing-Gallier

Function complete-implication-set?

Argument List: ([‍ctx impl-set])

Documentation:

Checks wheter given set of implications is complete in context ctx. This is a very costly computation.

Function conclusion

Argument List: ([‍thing])

Documentation:

Returns conclusion of given object.

Function confidence

Argument List: ([‍implication context])

Documentation:

Computes the confidence of the given implication in the given context.

Function equivalence-oracle-by-implications

Argument List: ([‍background-implications])

Documentation:

Return a function that can serve as an equivalence oracle for query learning.

The returned oracle will return true if a given set S of implications is equivalent to background-implications. Otherwise, it will return a counterexample, i.e., model of S that is not a model ov background-implications or vice versa.

Function equivalent-implications?

Argument List: ([‍impls-1 impls-2])

Documentation:

Returns true iff the two seqs of implications are equivalent.

Function follows-semantically?

Argument List: ([‍implication implications])

Documentation:

Returns true iff implication follows semantically from given implications.

Function follows?

Argument List: ([‍implication implications])

Documentation:

Returns true iff implication follows semantically from given implications.

Function frequent-closed-itemsets

Argument List: ([‍context minsupp])

Documentation:

Computes for context a lazy sequence of all frequent and closed itemsets, given minsupp as minimal support.

Function frequent-itemsets

Argument List: ([‍context minsupp])

Documentation:

Returns all frequent itemsets of context, given minsupp as minimal support.

Function holds?

Argument List: ([‍impl ctx])

Documentation:

Returns true iff impl holds in given context ctx.

Function impl

Argument List: ([‍& elements])

Documentation:

Convenience interface for creating implications. Write implications just as

user=> (impl 1 2 3 ==> 4 5 6)
(#{1 2 3} ==> #{4 5 6}) 

Function implication-graph

Argument List: ([‍implications])

Documentation:

Compute setup for Downing-Gallier

Function implication?

Argument List: ([‍thing])

Documentation:

Returns true iff thing is an implication.

Function intersect-implicational-theories

Argument List: ([‍base-set & implication-sets])

Documentation:

Given a set «base-set» and collections «implication-sets» of implications, returns the canonical base of the intersection of the corresponding closure theories.

Function irredundant-subset

Argument List: ([‍impls])

Documentation:

Given a set impls of implications, returns an irredundant subset of impls. Note that this set does not need to be of minimal cardinality.

Function learn-implications-by-queries

Argument List: ([‍base-set member? equivalent?])

Documentation:

Learn an implicational theory on base-set with access to membership oracle member?' and equivalence oracleequivalent?'.

The membership oracle has to decide for a given set S whether S is a model of the background theory to be learned. The equivalence oracle has to decide whether a given set of implications is equivalent to the background theory. For this it needs to return true if the theories are equivalent, and a counterexample otherwise, i.e., a subset of base-set that is a model of the current hypothesis and not a model of the background theory, or vice versa.

This function implements the HORN1 algorithm of Angluin, Frazier, and Pitt: “Learning Conjunctions of Horn Clauses”, 1992.

Function luxenburger-base

Argument List: ([‍context minsupp-or-predicate minconf])

Documentation:

Computes the luxenburger-base of a given context «context», returning the result as a lazy sequence. Uses «minconf» as minimal confidence. If «minsupp-or-predicate» is a number, uses that as a minimal support threshold. In this case, «minsupp» ∈ [0,1] must hold. If «minsupp-or-predicate» is a function, uses this as a predicate to filter all candidate itemsets. In this case, the predicate should be valid predicate value for «intents».

Function luxenburger-basis

Argument List: ([‍context minsupp-or-predicate minconf])

Documentation:

Computes the luxenburger-base of a given context «context», returning the result as a lazy sequence. Uses «minconf» as minimal confidence. If «minsupp-or-predicate» is a number, uses that as a minimal support threshold. In this case, «minsupp» ∈ [0,1] must hold. If «minsupp-or-predicate» is a function, uses this as a predicate to filter all candidate itemsets. In this case, the predicate should be valid predicate value for «intents».

Function make-implication

Argument List: ([‍premise conclusion])

Documentation:

Creates an implication (premise => conclusion \ premise).

Function membership-oracle-by-implications

Argument List: ([‍implications])

Documentation:

Return a function that can serve as a membership oracle for query learning.

The returned oracle will return true if a given set S of elements is a model of implications, and false otherwise.

Function minimal-implication-set?

Argument List: ([‍impl-set])

Documentation:

Checks whether given set of implications is minimal, i.e. no implication in this set follows from the others.

Function parallel-canonical-base

Argument List: ([‍ctx] [‍ctx background-knowledge])

Documentation:

Computes the canonical base of the given formal context. Background knowledge can be provided as a set of implications on the attribute set of the given context. Computation is eager and is done in parallel.

Function parallel-canonical-base-from-clop

Argument List: ([‍clop base] [‍clop base background-knowledge])

Documentation:

Computes the canonical base of the given closure operator in parallel. Accepts the same parameters as «canonical-base-from-clop», except for the predicate.

Function premise

Argument List: ([‍thing])

Documentation:

Returns premise of given object.

Function proper-conclusion

Argument List: ([‍ctx A])

Documentation:

Returns all elements which are implied in context ctx by A but are neither contained in A or follow from a strict subsets of A.

Function proper-premise-implications

Argument List: ([‍ctx])

Documentation:

Returns all implications based on the proper premises of the context ctx.

Function proper-premise?

Argument List: ([‍ctx A])

Documentation:

Returns true iff set A is a subset of the attributes of context ctx and is a proper premise in ctx.

Function proper-premises

Argument List: ([‍ctx])

Documentation:

Returns the proper premises of the given context ctx as a lazy sequence.

Function proper-premises-by-hypertrans

Argument List: ([‍ctx m objs])

Documentation:

Returns all proper premises for the attribute «m» in the formal context «ctx». The set «objs» should contain all objects from ctx which are in down-arrow relation to m.

Function proper-premises-for-attribute

Argument List: ([‍ctx m])

Documentation:

Returns all proper premises for the attribute «m» in the formal context «ctx».

Function pseudo-clop-by-implications

Argument List: ([‍implications])

Documentation:

Returns for a given set of implications the corresponding closure operator whose closures are all closed and pseudo-closed sets.

Function pseudo-close-under-implications

Argument List: ([‍implications set])

Documentation:

Computes smallest superset of set being pseudo-closed under given implications.

Function pseudo-intents

Argument List: ([‍ctx])

Documentation:

Returns the pseudo intents of the given context ctx.

Function respects?

Argument List: ([‍set impl])

Documentation:

Returns true iff set respects given implication impl.

Function ryssel-base

Argument List: ([‍ctx])

Documentation:

Returns the implications computed by Ryssels Algorithm, as a lazy sequence.

Function sound-implication-set?

Argument List: ([‍ctx impl-set])

Documentation:

Checks whether given set of implications is sound, i.e. every implication holds in the given context.

Function stem-base

Argument List: ([‍ctx] [‍ctx background-knowledge] [‍ctx background-knowledge predicate])

Documentation:

Returns the canonical base of given context, as a lazy sequence. Uses «background-knowledge» as starting set of implications, which will not appear in the result. If «predicate» is given (a function), computes only those implications from the canonical base whose premise satisfy this predicate, i.e. «predicate» returns true on these premises. Note that «predicate» has to satisfy the same conditions as the predicate to «next-closed-set-in-family».

Function stem-base-from-base

Argument List: ([‍implications])

Documentation:

For a given set of implications returns its stem-base.

Function support

Argument List: ([‍thing ctx])

Documentation:

Computes the support of the set of attributes B in context ctx. If an implications is given, returns the support of this implication in the given context.

Function tautology?

Argument List: ([‍impl])

Documentation:

Returns true iff impl has empty conclusion.

Public API of conexp.fca.exploration

Provides function for exploration and computing proper premises.

Available Functions

Function Documentation

Function counterexamples-via-repl

Argument List: ([‍ctx knowledge impl])

Documentation:

Starts a repl for counterexamples, which must be specified completely.

Function default-handler-for-complete-counterexamples

Argument List: ([‍ctx known impl])

Documentation:

Default handler for attribute exploration. Does it's interaction on the console.

Function default-handler-for-incomplete-counterexamples

Argument List: ([‍possible-ctx certain-ctx known impl])

Documentation:

Default handler for attribute exploration with incomplete counterexamples. Does it's interaction on the console.

Function eval-command

Argument List: ([‍query state])

Documentation:

Runs the given REPL command query with state, in the case the query uniquely determines a command. If not, an error message is printed and state is returned.

Function examples-by-automorphisms

Argument List: ([‍ctx [‍g atts] auts])

Documentation:

Generates for the given context ctx and a given example row [g atts] a sequence of new examples (as rows of the same form) by applying the context automorphism in auts. The context automorphisms are applied to the attributes in atts only, the corresponding object will be a newly generated.

Function explore-attributes

Argument List: ([‍& {:keys [‍possible-context certain-context context background-knowledge handler incomplete-counterexamples]}])

Documentation:

Performs attribute exploration on the given context(s). Returns a hashmap of implications computed and the final context, stored with keys :implications and :context (in the case of complete counterexamples) or :possible-context/:certain-context (in the case of incomplete counterexamples), respectively.

Arguments are passed as keyword arguments like so

(explore-attributes
  :context ctx-1
  :handler my-handler)

(explore-attributes
  :incomplete-counterexamples true
  :possible-context ctx-1
  :certain-context  ctx-2
  :handler          my-other-handler
  :background-knowledge #{})

Either a value for :context or values for :possible-context and :certain-context must be given, but not both. The second option is only possible if :incomplete-counterexamples is set to «true».

Optional keyword arguments are:

  • :handler «fn»

    Interaction is accomplished via the given handler fn. Depending on whether incomplete counterexamples are allowed or not, this handler is called with different arguments and is supposed to return different things:

    • if incomplete counterexamples are not allowed, «fn» is called (in this order) with the current working context, the set of known implications and the current implication to be asked to the expert. It is supposed to return either «nil» (in which case the implication is accepted), or a sequence of counterexamples which are supposed to be of the form

      [g attributes]

      where «g» is the name of a new object and «attributes» is the set of attributes the new object should possess.

    • if incomplete counterexamples are allowed, «fn» is called with the context of possible incidences, the context of certain incidence, the set of known implications and the current implication to be asked to the expert. It is supposed to return either «nil» (in which case the implication is accepted), or a sequence of counterexamples of the form

      [g positive-attributes negative-attributes],

      where «g» is a new object, «positive-attributes» is a sequence of attributes the new object has, and «negative-attributes» is a sequence of attributes the new object does not have. Note that «positive-attributes» and «negative-attributes» must be disjoint.

    Note that it is the responsibility of the handler to ensure that the counterexample is correct. If this is not the case, the exploration algorithm will just ask the same question in the next iteration again.

    It is possible to abort the exploration from within a handler. For this, the handler just has to return :abort. In this case, the current working context as well as the currently known implications are returned as if the exploration would have been finished in that iteration.

  • :background-knowledge «set of implications»

    background-knowledge denotes a set of implications used as background knowledge, which will be subtracted from the computed result.

  • :incomplete-counterexamples «true or false»

    Specifies whether incomplete counterexamples are allowed or not. Default is false. Mandatory to be set to true if context is given via :possible-context and :certain-context.

If you want to use automorphisms of the underlying context, you have to construct a special handler using the «make-handler» function. See the corresponding documentation of «make-handler».

Function explore-attributes-with-complete-counterexamples

Argument List: ([‍ctx background-knowledge handler])

Documentation:

Performs attribute exploration with complete background knowledge

Function explore-attributes-with-incomplete-counterexamples

Argument List: ([‍possible-ctx certain-ctx background-knowledge handler])

Documentation:

Performs attribute exploration allowing for incomplete counterexamples

Function falsifies-implication?

Argument List: ([‍new-atts impl])

Documentation:

Returns true iff set of new attributes does not respect implication impl.

Function help-repl-command

Argument List:

Documentation:

Returns the help string of the given command.

Function incomplete-counterexamples-via-repl

Argument List: ([‍possible-ctx certain-ctx knowledge impl])

Documentation:

Starts a repl for counterexamples, which may be incomplete.

Function make-handler

Argument List: ([‍& {:keys [‍automorphisms incomplete-counterexamples?], :or {automorphisms #{}, incomplete-counterexamples? false}}])

Documentation:

Creates a handler for attribute exploration. Valid keys are

  • automorphisms: A sequence of automorphisms of the overall context, used to construct more examples from a given one.

    Currently, this has only an effect if the counterexamples are complete.

  • incomplete-counterexamples?: If true, allows for incomplete counterexamples. In contrast to the case of complete counterexamples, the function returned takes four arguments (instead of 3), namely the context of the possible incidence, the context of the certain incidence, the known implications as well as the current implication to be asked to the expert.

Function run-repl-command

Argument List:

Documentation:

Runs a command for the counterexample REPL.

Function saturate-partial-example

Argument List: ([‍impls positives negatives unknown])

Documentation:

Saturates the partial example given by positives, negatives and unknown. Uses the set impls of implications for saturation.

Function suitable-repl-commands

Argument List: ([‍query])

Documentation:

Returns all known repl commands for query, which can be a symbol or a string.

Function valid-counterexample?

Argument List: ([‍state attributes impl])

Documentation:

Checks the given example for being valid.

Public API of conexp.fca.lattices

Basis datastructure and definitions for abstract lattices.

Available Functions

Function Documentation

Function ->Lattice

Argument List: ([‍base-set order-function inf sup])

Documentation:

Positional factory function for class conexp.fca.lattices.Lattice.

Function base-set

Argument List: ([‍lattice])

Documentation:

Returns the base set of lattice.

Function concept-lattice

Argument List: ([‍ctx])

Documentation:

Returns for a given context ctx its concept lattice.

Function directly-neighboured?

Argument List: ([‍lat x y])

Documentation:

Checks whether x is direct lower neighbour of y in lattice lat.

Function distributive?

Argument List: ([‍lat])

Documentation:

Checks (primitively) whether given lattice lat is distributive or not.

Function dual-lattice

Argument List: ([‍lat])

Documentation:

Dualizes given lattice lat.

Function has-lattice-order?

Argument List: ([‍lat])

Documentation:

Given a lattice checks if its order is indeed a lattice order.

Function inf

Argument List: ([‍lattice])

Documentation:

Returns a function computing the infimum in lattice.

Function lattice-atoms

Argument List: ([‍lat])

Documentation:

Returns the lattice atoms of lat.

Function lattice-coatoms

Argument List: ([‍lat])

Documentation:

Returns the lattice coatoms of lat.

Function lattice-doubly-irreducibles

Argument List: ([‍lat])

Documentation:

Returns all (i.e. sup and inf) irreducible elements of lattice lat.

Function lattice-inf-irreducibles

Argument List: ([‍lat])

Documentation:

Returns the inf-irreducible elements of lattice lat.

Function lattice-lower-neighbours

Argument List: ([‍lat y])

Documentation:

Returns all direct lower neighbours of y in lattice lat.

Function lattice-one

Argument List: ([‍lat])

Documentation:

Returns the one element of lattice lat.

Function lattice-sup-irreducibles

Argument List: ([‍lat])

Documentation:

Returns the sup-irreducible elements of lattice lat.

Function lattice-upper-neighbours

Argument List: ([‍lat x])

Documentation:

Returns all direct upper neighbours of x in lattice lat.

Function lattice-zero

Argument List: ([‍lat])

Documentation:

Returns the zero element of lattice lat.

Function make-lattice

Argument List: ([‍& args])

Documentation:

Standard constructor for makeing lattice. Call with two arguments [base-set order] to construct the lattice by its order relation (given as a set of pairs or as a function of two arguments). Call with three arguments [base-set inf sup] to construct the lattice by its algebraic operations.

Note: This function will test the resulting lattice for being one, which may take some time. If you don't want this, use make-lattice-nc.

Function make-lattice-nc

Argument List: ([‍base-set order-function] [‍base-set inf sup] [‍base-set order-function inf sup])

Documentation:

Creates a new lattice from the given arguments, without any checks. Use with care.

Function modular?

Argument List: ([‍lat])

Documentation:

Checks (primitively) whether given lattice lat is modular or not.

Function order

Argument List: ([‍lattice])

Documentation:

Returns a function of one or two arguments representing the order relation. If called with one argument it is assumed that this argument is a pair of elements.

Function standard-context

Argument List: ([‍lat])

Documentation:

Returns the standard context of lattice lat.

Function sup

Argument List: ([‍lattice])

Documentation:

Returns a function computing the supremum in lattice.

Public API of conexp.fca.more

More on FCA.

Available Functions

Function Documentation

Function *fast-computation*

Argument List:

Documentation:

Enable computation of concept probability with floating point arithmetic instead of rationals

Function all-bonds

Argument List: ([‍ctx-1 ctx-2])

Documentation:

Returns all bonds between ctx-1 and ctx-2.

Function all-bonds-by-shared-intents

Argument List: ([‍ctx-1 ctx-2])

Documentation:

All bonds between ctx-1 and ctx-2, computed using shared intents.

Function all-shared-intents

Argument List: ([‍ctx-1 ctx-2])

Documentation:

All intents shared between contexts ctx-1 and ctx-2. ctx-1 and ctx-2 must have the same attribute set.

Function average-concept-robustness

Argument List: ([‍concepts alpha])

Documentation:

Takes the seq concepts' consisting of all concepts of a context and computes the average concept robustness with parmateralpha'.

Function bond?

Argument List: ([‍ctx-1 ctx-2 ctx])

Documentation:

Checks whether context ctx is a bond between ctx-1 and ctx-2.

Function concept-probability

Argument List: ([‍context concept])

Documentation:

Compute the probability of a concept' incontext' 𝕂 in the following manner. Let pₘ be the relative frequence of attribute m in context. The probability of a subset B ⊆ M in 𝕂 is the product of all pₘ for m ∈ B. Then the probability of a concept is defined by pr(A,B) := pr(B=B'') which is ∑_{k=0}^n {n choose k}·p_Bᵏ·(1-p_B)ⁿ⁻ᵏ·∏_{m ∈ M ∖ B}(1-p_mᵏ).

Function concept-robustness

Argument List: ([‍concept concepts alpha sorted?] [‍concept concepts alpha])

Documentation:

Computes the robustness of a concept' in a context with parameteralpha' by using the seq concepts' consisting of all concepts of the context. The optional boolean parametersorted?' allows to declare the seq of concepts as beeing already sorted by increasing size of the attribute set. This function uses the function concept-robustness-polynomial.

Function concept-robustness-add-next-entry

Argument List: ([‍concept cache])

Documentation:

Helper-function for `concept-robustness-polynomial'.

This function computes the value e(Y,concept'), based on the already computed values e(Z,concept'), which are given in the second parameter cache' in the form [Z, e(Z,concept')].

This function is needed in the algorithm on page 19 in "Finding Robust Itemsets under Subsampling" from Tatti, Moerchen, and Calders.

Function concept-robustness-polynomial

Argument List: ([‍concept concepts sorted?] [‍concept concepts])

Documentation:

Return the coefficients of the robustness polynomial of `concept'.

For the given concept' of a context, the coefficients of the polynomial p corresponding to the robustness is computed by using the seqconcepts' of all concepts of the context. The optional boolean parameter `sorted?' allows to declare the seq of concepts as being already sorted by increasing attribute-set. Thus if v is the result of (robustness-polynomial concept concepts), then (eval-polynomial v (- 1 alpha)) computes the robustness with parameter alpha.

For details see "Finding Robust Itemsets under Subsampling" from Tatti, Moerchen, and Calders, pages 17–19.

Function concept-stability

Argument List: ([‍context concept])

Documentation:

Compute the concept stability of concept' incontext'.

Function context-from-clop

Argument List: ([‍base-set clop])

Documentation:

Returns a context whose intents are exactly the closed sets of the given closure operator on the given base-set.

Function implication-context

Argument List: ([‍n])

Documentation:

Returns a context for a non-negative number n which has as it's extents the closure systems on the set {0 .. (n-1)} and as it's intents the corresponding implicational theory.

Function jaccard-index

Argument List: ([‍x y])

Documentation:

Computes the Jaccard index of two sets. This is |x ∩ y| / |x ∪ y|. Returns 1 if both sets are empty.

Function maximal-counterexample

Argument List: ([‍c base-set B C])

Documentation:

For a given closure operator c on a set base-set, maximizes the set C (i.e. returns a superset of C) that is not a superset of B (i.e. there exists an element m in B without C that is also not in the result.

Function next-shared-intent

Argument List: ([‍ctx-1 ctx-2 b])

Documentation:

The smallest shared intent of contexts ctx-1 and ctx-2 containing b.

Function smallest-bond

Argument List: ([‍ctx-1 ctx-2 rel])

Documentation:

Returns the smallest bond between ctx-1 and ctx-2 that has the elements of rel as crosses.

Function sorensen-coefficient

Argument List: ([‍x y])

Documentation:

Computes the Sorensen coefficient of two sets. This is 2 * |x ∩ y| / (|x| + |y|). Returns 1 if both sets are empty.

Function weighted-concept-similarity

Argument List: ([‍sim [‍c1 c2]] [‍sim [‍c1 c2] w])

Documentation:

Computes a weighted concept similarity for a given similatity measure sim', two concepts [c1' c2'] and an optional weightw' (default is 1/2).

That is the weighted average of the similarity of the extents/object sets (weight w') and the intents/attribute sets (weight 1-w').

This is from Alqadah, F. & Bhatnagar, R. (2011), 'Similarity measures in formal concept analysis.', Ann. Math. Artif. Intell. 61 (3), 249, https://doi.org/10.1007/s10472-011-9257-7

Public API of conexp.io.latex

Provides functionality to represent conexp-clj datastructures as latex code.

Available Functions

Function Documentation

Function latex

Argument List: ([‍this] [‍this choice])

Documentation:

Returns a string representation of this.

Function tex-escape

Argument List: ([‍string])

Documentation:

Escapes all significant characters used by LaTeX.

Public API of conexp.io.contexts

Available Functions

Function Documentation

Function define-context-input-format

Argument List: ([‍input-format [‍file] & body])

Documentation:

Defines input format for contexts.

Function define-context-output-format

Argument List: ([‍input-format [‍thing file] & body])

Documentation:

Defines output format for contexts.

Function find-context-input-format

Argument List: ([‍file__7379__auto__] [‍file__7379__auto__ format__7380__auto__])

Documentation:

Tries to determine the format used in file.

Function get-default-context-format

Argument List: ([‍])

Documentation:

Returns default write format for contexts.

Function list-context-formats

Argument List: ([‍])

Documentation:

Returns a list of known context IO formats, i.e. formats for which reading and writing is defined.

Function list-context-input-formats

Argument List: ([‍])

Documentation:

Returns a list of known context input formats

Function list-context-output-formats

Argument List: ([‍])

Documentation:

Returns a list of known context input formats

Function read-context

Argument List: ([‍file] [‍file explicit-format])

Documentation:

Reads context from file, automatically determining the format used.

Function set-default-context-format!

Argument List: ([‍format__7380__auto__])

Documentation:

Sets default write format for contexts to format.

Function write-context

Argument List: ([‍format context file] [‍context file])

Documentation:

Writes context to file using format.

Public API of conexp.io.lattices

Available Functions

Function Documentation

Function define-lattice-input-format

Argument List: ([‍input-format [‍file] & body])

Documentation:

Defines input format for lattices.

Function define-lattice-output-format

Argument List: ([‍input-format [‍thing file] & body])

Documentation:

Defines output format for lattices.

Function find-lattice-input-format

Argument List: ([‍file__7379__auto__] [‍file__7379__auto__ format__7380__auto__])

Documentation:

Tries to determine the format used in file.

Function get-default-lattice-format

Argument List: ([‍])

Documentation:

Returns default write format for lattices.

Function list-lattice-formats

Argument List: ([‍])

Documentation:

Returns a list of known lattice IO formats, i.e. formats for which reading and writing is defined.

Function list-lattice-input-formats

Argument List: ([‍])

Documentation:

Returns a list of known lattice input formats

Function list-lattice-output-formats

Argument List: ([‍])

Documentation:

Returns a list of known lattice input formats

Function read-lattice

Argument List: ([‍file] [‍file explicit-format])

Documentation:

Reads lattice from file, automatically determining the format used.

Function set-default-lattice-format!

Argument List: ([‍format__7380__auto__])

Documentation:

Sets default write format for lattices to format.

Function write-lattice

Argument List: ([‍format lattice file] [‍lattice file])

Documentation:

Writes lattice to file using format.

Public API of conexp.io.layouts

Implements IO for layouts.

Available Functions

Function Documentation

Function define-layout-input-format

Argument List: ([‍input-format [‍file] & body])

Documentation:

Defines input format for layouts.

Function define-layout-output-format

Argument List: ([‍input-format [‍thing file] & body])

Documentation:

Defines output format for layouts.

Function find-layout-input-format

Argument List: ([‍file__7379__auto__] [‍file__7379__auto__ format__7380__auto__])

Documentation:

Tries to determine the format used in file.

Function get-default-layout-format

Argument List: ([‍])

Documentation:

Returns default write format for layouts.

Function list-layout-formats

Argument List: ([‍])

Documentation:

Returns a list of known layout IO formats, i.e. formats for which reading and writing is defined.

Function list-layout-input-formats

Argument List: ([‍])

Documentation:

Returns a list of known layout input formats

Function list-layout-output-formats

Argument List: ([‍])

Documentation:

Returns a list of known layout input formats

Function read-layout

Argument List: ([‍file] [‍file explicit-format])

Documentation:

Reads layout from file, automatically determining the format used.

Function seq-positions

Argument List: ([‍seq])

Documentation:

Returns a map from elements of seq to their positions.

Function set-default-layout-format!

Argument List: ([‍format__7380__auto__])

Documentation:

Sets default write format for layouts to format.

Function write-layout

Argument List: ([‍format layout file] [‍layout file])

Documentation:

Writes layout to file using format.

Public API of conexp.io.many-valued-contexts

Implements IO for Many-Valued Contexts.

Available Functions

Function Documentation

Function define-mv-context-input-format

Argument List: ([‍input-format [‍file] & body])

Documentation:

Defines input format for mv-contexts.

Function define-mv-context-output-format

Argument List: ([‍input-format [‍thing file] & body])

Documentation:

Defines output format for mv-contexts.

Function find-mv-context-input-format

Argument List: ([‍file__7379__auto__] [‍file__7379__auto__ format__7380__auto__])

Documentation:

Tries to determine the format used in file.

Function get-default-mv-context-format

Argument List: ([‍])

Documentation:

Returns default write format for mv-contexts.

Function list-mv-context-formats

Argument List: ([‍])

Documentation:

Returns a list of known mv-context IO formats, i.e. formats for which reading and writing is defined.

Function list-mv-context-input-formats

Argument List: ([‍])

Documentation:

Returns a list of known mv-context input formats

Function list-mv-context-output-formats

Argument List: ([‍])

Documentation:

Returns a list of known mv-context input formats

Function read-many-valued-context

Argument List: ([‍file] [‍file explicit-format])

Documentation:

Reads mv-context from file, automatically determining the format used.

Function read-mv-context

Argument List: ([‍file] [‍file explicit-format])

Documentation:

Reads mv-context from file, automatically determining the format used.

Function set-default-mv-context-format!

Argument List: ([‍format__7380__auto__])

Documentation:

Sets default write format for mv-contexts to format.

Function write-many-valued-context

Argument List: ([‍format mv-context file] [‍mv-context file])

Documentation:

Writes mv-context to file using format.

Function write-mv-context

Argument List: ([‍format mv-context file] [‍mv-context file])

Documentation:

Writes mv-context to file using format.

Public API of conexp.layouts

Available Functions

Function Documentation

Function inf-additive-layout

Argument List: ([‍lattice])

Documentation:

Returns an infimum additive layout for lattice.

Function standard-layout

Argument List:

Documentation:

Standard layout function. Call on a lattice to get a layout.

Can you improve this documentation?Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close