qumin.lattice package¶
Submodules¶
qumin.lattice.lattice module¶
- class qumin.lattice.lattice.ICLattice(onehot_encoding, leaves, annotate=None, comp_prefix=None, aoc=False, keep_names=False)[source]¶
Bases:
objectInflection class Lattice representation.
This is a wrapper around (
concepts.Context). It builds on concepts’ lattice class, but adopts a custom representation of lattices, using Qumin’s :class:`qumin.clustering.node.Node class.- Variables:
context (concepts.Context) – stores the underlying Context.
lattice (concepts.lattices.Lattice) – shortcut to the underlying lattice.
nodes (qumin.clustering.node.Node) – Qumin’s lattice is represented as a root node. Each node contains its children. This is the lattice we will draw.
comp – ?.
leaves – dictionary of object properties (typically microclasses). The format is: {<object label>: {‘size’: <size>, ‘other’: <prop>}}. If the size argument is provided, it will be used to render the nodes.
- __init__(onehot_encoding, leaves, annotate=None, comp_prefix=None, aoc=False, keep_names=False)[source]¶
- Parameters:
onehot_encoding (pandas.DataFrame) – onehot encoding of objects (rows) and attributes (columns). Filled with 1/0, True/False, “X”/””.
leaves (dict) – Dictionary of microclasses.
annotate (dict) – Extra annotations to add on lattice. Of the form: {<object label>: <annotation>}
aoc (bool) – Whether to limit ourselves to Attribute or Object Concepts.
keep_names – ? TODO, this option is apparently not implemented.
kwargs – all other keyword arguments are passed to table_to_context
- draw(filename, title='Lattice', **kwargs)[source]¶
Wrapper around :method:`ICLattice.draw_nodes`.
- draw_nodes(figsize=(24, 12), scale=False, colormap='Blues', point=None, **kwargs)[source]¶
Draw the root node using
qumin.clustering.node.Node’s drawing function.
- classmethod from_patterns(patterns, paradigms, **kwargs)[source]¶
Creates a Lattice from a patterns object.
- Parameters:
patterns (representations.patternstore.PatternStore) – the patterns computed for the paradigms.
paradigms (qumin.representations.paradigms.Paradigms) – the paradigms.
- parents(identifier)[source]¶
Return all direct parents of a node which corresponds to the identifier.
- qumin.lattice.lattice.context_from_pandas(df)[source]¶
Converts a onehot encoding stored as a
pandas.DataFrameto aconcepts.Context. Uses the following recipe: https://concepts.readthedocs.io/en/stable/advanced.html#context-from-pandas-dataframe- Parameters:
df (pandas.DataFrame) – onehot encoding of objects (rows) and attributes (columns). Filled with 1/0, True/False or “X”/””.
- Returns:
a Context representing the input data.
- Return type: