conceptflow 0.2.0__tar.gz → 0.3.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. conceptflow-0.3.1/PKG-INFO +168 -0
  2. conceptflow-0.3.1/README.md +101 -0
  3. {conceptflow-0.2.0 → conceptflow-0.3.1}/pyproject.toml +5 -0
  4. conceptflow-0.3.1/src/conceptflow/_version.py +1 -0
  5. {conceptflow-0.2.0 → conceptflow-0.3.1}/src/conceptflow/algorithms/__init__.py +10 -0
  6. {conceptflow-0.2.0 → conceptflow-0.3.1}/src/conceptflow/algorithms/_registry.py +1 -1
  7. conceptflow-0.3.1/src/conceptflow/algorithms/enumeration.py +368 -0
  8. conceptflow-0.3.1/src/conceptflow/algorithms/generators.py +77 -0
  9. {conceptflow-0.2.0 → conceptflow-0.3.1}/src/conceptflow/algorithms/hasse.py +14 -1
  10. {conceptflow-0.2.0 → conceptflow-0.3.1}/src/conceptflow/algorithms/implications.py +63 -3
  11. {conceptflow-0.2.0 → conceptflow-0.3.1}/src/conceptflow/algorithms/reduction.py +83 -1
  12. {conceptflow-0.2.0 → conceptflow-0.3.1}/src/conceptflow/cluster/concept_lattice.py +87 -4
  13. {conceptflow-0.2.0 → conceptflow-0.3.1}/src/conceptflow/core/__init__.py +14 -0
  14. conceptflow-0.3.1/src/conceptflow/core/context.py +437 -0
  15. {conceptflow-0.2.0 → conceptflow-0.3.1}/src/conceptflow/core/incomplete_context.py +12 -3
  16. conceptflow-0.3.1/src/conceptflow/core/lattice.py +326 -0
  17. {conceptflow-0.2.0 → conceptflow-0.3.1}/src/conceptflow/core/many_valued_context.py +13 -0
  18. conceptflow-0.3.1/src/conceptflow/core/operations.py +160 -0
  19. {conceptflow-0.2.0 → conceptflow-0.3.1}/src/conceptflow/decomposition/ordinal_factorization.py +75 -102
  20. {conceptflow-0.2.0 → conceptflow-0.3.1}/src/conceptflow/exploration/__init__.py +6 -1
  21. {conceptflow-0.2.0 → conceptflow-0.3.1}/src/conceptflow/exploration/combinations.py +54 -1
  22. {conceptflow-0.2.0 → conceptflow-0.3.1}/src/conceptflow/feature_extraction/concept_encoder.py +5 -0
  23. conceptflow-0.3.1/src/conceptflow/io/__init__.py +20 -0
  24. {conceptflow-0.2.0 → conceptflow-0.3.1}/src/conceptflow/io/cxt.py +24 -1
  25. conceptflow-0.3.1/src/conceptflow/io/formats.py +174 -0
  26. conceptflow-0.3.1/src/conceptflow/metrics/__init__.py +29 -0
  27. conceptflow-0.3.1/src/conceptflow/metrics/measures.py +347 -0
  28. {conceptflow-0.2.0 → conceptflow-0.3.1}/src/conceptflow/metrics/rules.py +11 -4
  29. {conceptflow-0.2.0 → conceptflow-0.3.1}/src/conceptflow/preprocessing/conceptual_scaler.py +13 -0
  30. {conceptflow-0.2.0 → conceptflow-0.3.1}/src/conceptflow/preprocessing/scales.py +21 -18
  31. conceptflow-0.3.1/src/conceptflow/quality.py +377 -0
  32. {conceptflow-0.2.0 → conceptflow-0.3.1}/src/conceptflow/rules/__init__.py +2 -0
  33. {conceptflow-0.2.0 → conceptflow-0.3.1}/src/conceptflow/rules/implication_basis.py +18 -2
  34. conceptflow-0.3.1/src/conceptflow/rules/outlier_detector.py +231 -0
  35. {conceptflow-0.2.0 → conceptflow-0.3.1}/src/conceptflow/validation/input.py +50 -1
  36. {conceptflow-0.2.0 → conceptflow-0.3.1}/src/conceptflow/visualization/__init__.py +16 -0
  37. {conceptflow-0.2.0 → conceptflow-0.3.1}/src/conceptflow/visualization/d3_backend.py +33 -17
  38. {conceptflow-0.2.0 → conceptflow-0.3.1}/src/conceptflow/visualization/dimflux_layout.py +10 -2
  39. {conceptflow-0.2.0 → conceptflow-0.3.1}/src/conceptflow/visualization/graph_data.py +50 -1
  40. conceptflow-0.3.1/src/conceptflow/visualization/graphviz.py +153 -0
  41. {conceptflow-0.2.0 → conceptflow-0.3.1}/src/conceptflow/visualization/html_figure.py +9 -0
  42. {conceptflow-0.2.0 → conceptflow-0.3.1}/src/conceptflow/visualization/lattice_plot.py +30 -8
  43. conceptflow-0.3.1/src/conceptflow/visualization/layered_layout.py +199 -0
  44. {conceptflow-0.2.0 → conceptflow-0.3.1}/src/conceptflow/visualization/nested.py +47 -13
  45. {conceptflow-0.2.0 → conceptflow-0.3.1}/src/conceptflow/visualization/static.py +122 -107
  46. conceptflow-0.3.1/src/conceptflow/visualization/tikz.py +301 -0
  47. conceptflow-0.3.1/src/conceptflow.egg-info/PKG-INFO +168 -0
  48. {conceptflow-0.2.0 → conceptflow-0.3.1}/src/conceptflow.egg-info/SOURCES.txt +20 -0
  49. {conceptflow-0.2.0 → conceptflow-0.3.1}/src/conceptflow.egg-info/requires.txt +4 -0
  50. {conceptflow-0.2.0 → conceptflow-0.3.1}/tests/test_check_estimator.py +21 -2
  51. conceptflow-0.3.1/tests/test_context_handling.py +105 -0
  52. conceptflow-0.3.1/tests/test_context_operations.py +109 -0
  53. conceptflow-0.3.1/tests/test_docs_examples.py +78 -0
  54. {conceptflow-0.2.0 → conceptflow-0.3.1}/tests/test_enumeration.py +5 -1
  55. conceptflow-0.3.1/tests/test_generators.py +69 -0
  56. conceptflow-0.3.1/tests/test_lattice_navigation.py +180 -0
  57. conceptflow-0.3.1/tests/test_layout_and_graphviz.py +85 -0
  58. conceptflow-0.3.1/tests/test_measures.py +167 -0
  59. conceptflow-0.3.1/tests/test_patch_0_3_1.py +287 -0
  60. conceptflow-0.3.1/tests/test_quality.py +193 -0
  61. conceptflow-0.3.1/tests/test_review_fixes.py +213 -0
  62. {conceptflow-0.2.0 → conceptflow-0.3.1}/tests/test_static_figures.py +5 -4
  63. conceptflow-0.3.1/tests/test_tikz.py +73 -0
  64. conceptflow-0.2.0/PKG-INFO +0 -834
  65. conceptflow-0.2.0/README.md +0 -771
  66. conceptflow-0.2.0/src/conceptflow/_version.py +0 -1
  67. conceptflow-0.2.0/src/conceptflow/algorithms/enumeration.py +0 -218
  68. conceptflow-0.2.0/src/conceptflow/core/context.py +0 -283
  69. conceptflow-0.2.0/src/conceptflow/core/lattice.py +0 -144
  70. conceptflow-0.2.0/src/conceptflow/io/__init__.py +0 -6
  71. conceptflow-0.2.0/src/conceptflow/metrics/__init__.py +0 -13
  72. conceptflow-0.2.0/src/conceptflow.egg-info/PKG-INFO +0 -834
  73. {conceptflow-0.2.0 → conceptflow-0.3.1}/LICENSE +0 -0
  74. {conceptflow-0.2.0 → conceptflow-0.3.1}/setup.cfg +0 -0
  75. {conceptflow-0.2.0 → conceptflow-0.3.1}/src/conceptflow/__init__.py +0 -0
  76. {conceptflow-0.2.0 → conceptflow-0.3.1}/src/conceptflow/algorithms/_bitset.py +0 -0
  77. {conceptflow-0.2.0 → conceptflow-0.3.1}/src/conceptflow/algorithms/_membership.py +0 -0
  78. {conceptflow-0.2.0 → conceptflow-0.3.1}/src/conceptflow/algorithms/derivation.py +0 -0
  79. {conceptflow-0.2.0 → conceptflow-0.3.1}/src/conceptflow/algorithms/order.py +0 -0
  80. {conceptflow-0.2.0 → conceptflow-0.3.1}/src/conceptflow/cluster/__init__.py +0 -0
  81. {conceptflow-0.2.0 → conceptflow-0.3.1}/src/conceptflow/core/concept.py +0 -0
  82. {conceptflow-0.2.0 → conceptflow-0.3.1}/src/conceptflow/decomposition/__init__.py +0 -0
  83. {conceptflow-0.2.0 → conceptflow-0.3.1}/src/conceptflow/exploration/builder.py +0 -0
  84. {conceptflow-0.2.0 → conceptflow-0.3.1}/src/conceptflow/exploration/view.py +0 -0
  85. {conceptflow-0.2.0 → conceptflow-0.3.1}/src/conceptflow/feature_extraction/__init__.py +0 -0
  86. {conceptflow-0.2.0 → conceptflow-0.3.1}/src/conceptflow/model_selection/__init__.py +0 -0
  87. {conceptflow-0.2.0 → conceptflow-0.3.1}/src/conceptflow/preprocessing/__init__.py +0 -0
  88. {conceptflow-0.2.0 → conceptflow-0.3.1}/src/conceptflow/validation/__init__.py +0 -0
  89. {conceptflow-0.2.0 → conceptflow-0.3.1}/src/conceptflow.egg-info/dependency_links.txt +0 -0
  90. {conceptflow-0.2.0 → conceptflow-0.3.1}/src/conceptflow.egg-info/top_level.txt +0 -0
  91. {conceptflow-0.2.0 → conceptflow-0.3.1}/tests/test_algorithm_registry.py +0 -0
  92. {conceptflow-0.2.0 → conceptflow-0.3.1}/tests/test_audit_regressions.py +0 -0
  93. {conceptflow-0.2.0 → conceptflow-0.3.1}/tests/test_cluster_estimator.py +0 -0
  94. {conceptflow-0.2.0 → conceptflow-0.3.1}/tests/test_concept.py +0 -0
  95. {conceptflow-0.2.0 → conceptflow-0.3.1}/tests/test_concept_encoder.py +0 -0
  96. {conceptflow-0.2.0 → conceptflow-0.3.1}/tests/test_conceptual_scaler.py +0 -0
  97. {conceptflow-0.2.0 → conceptflow-0.3.1}/tests/test_cxt_io.py +0 -0
  98. {conceptflow-0.2.0 → conceptflow-0.3.1}/tests/test_d3_backend.py +0 -0
  99. {conceptflow-0.2.0 → conceptflow-0.3.1}/tests/test_derivation.py +0 -0
  100. {conceptflow-0.2.0 → conceptflow-0.3.1}/tests/test_dimflux_layout.py +0 -0
  101. {conceptflow-0.2.0 → conceptflow-0.3.1}/tests/test_exploration.py +0 -0
  102. {conceptflow-0.2.0 → conceptflow-0.3.1}/tests/test_formal_context.py +0 -0
  103. {conceptflow-0.2.0 → conceptflow-0.3.1}/tests/test_graph_data.py +0 -0
  104. {conceptflow-0.2.0 → conceptflow-0.3.1}/tests/test_hasse.py +0 -0
  105. {conceptflow-0.2.0 → conceptflow-0.3.1}/tests/test_html_figure.py +0 -0
  106. {conceptflow-0.2.0 → conceptflow-0.3.1}/tests/test_implication_basis_estimator.py +0 -0
  107. {conceptflow-0.2.0 → conceptflow-0.3.1}/tests/test_implications.py +0 -0
  108. {conceptflow-0.2.0 → conceptflow-0.3.1}/tests/test_incomplete_context.py +0 -0
  109. {conceptflow-0.2.0 → conceptflow-0.3.1}/tests/test_lattice.py +0 -0
  110. {conceptflow-0.2.0 → conceptflow-0.3.1}/tests/test_many_valued_context.py +0 -0
  111. {conceptflow-0.2.0 → conceptflow-0.3.1}/tests/test_metrics.py +0 -0
  112. {conceptflow-0.2.0 → conceptflow-0.3.1}/tests/test_nested_combinations.py +0 -0
  113. {conceptflow-0.2.0 → conceptflow-0.3.1}/tests/test_nested_visualization.py +0 -0
  114. {conceptflow-0.2.0 → conceptflow-0.3.1}/tests/test_ordinal_factorization.py +0 -0
  115. {conceptflow-0.2.0 → conceptflow-0.3.1}/tests/test_public_api.py +0 -0
  116. {conceptflow-0.2.0 → conceptflow-0.3.1}/tests/test_reduction.py +0 -0
  117. {conceptflow-0.2.0 → conceptflow-0.3.1}/tests/test_scales.py +0 -0
  118. {conceptflow-0.2.0 → conceptflow-0.3.1}/tests/test_sklearn_compatibility.py +0 -0
  119. {conceptflow-0.2.0 → conceptflow-0.3.1}/tests/test_validation_input.py +0 -0
@@ -0,0 +1,168 @@
1
+ Metadata-Version: 2.4
2
+ Name: conceptflow
3
+ Version: 0.3.1
4
+ Summary: A scikit-learn compatible Formal Concept Analysis framework.
5
+ Author-email: Anurag Sharma <sharma@cs.uni-kassel.de>
6
+ License: BSD 3-Clause License
7
+
8
+ Copyright (c) 2025, Anurag Sharma
9
+
10
+ Redistribution and use in source and binary forms, with or without
11
+ modification, are permitted provided that the following conditions are met:
12
+
13
+ 1. Redistributions of source code must retain the above copyright notice, this
14
+ list of conditions and the following disclaimer.
15
+
16
+ 2. Redistributions in binary form must reproduce the above copyright notice,
17
+ this list of conditions and the following disclaimer in the documentation
18
+ and/or other materials provided with the distribution.
19
+
20
+ 3. Neither the name of the copyright holder nor the names of its
21
+ contributors may be used to endorse or promote products derived from
22
+ this software without specific prior written permission.
23
+
24
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
28
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
32
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
+
35
+ Project-URL: Homepage, https://github.com/anuragxorma/conceptflow
36
+ Project-URL: Documentation, https://conceptflow.readthedocs.io
37
+ Project-URL: Repository, https://github.com/anuragxorma/conceptflow
38
+ Project-URL: Issues, https://github.com/anuragxorma/conceptflow/issues
39
+ Keywords: formal-concept-analysis,fca,scikit-learn,concept-lattice,conceptual-scaling
40
+ Classifier: Development Status :: 3 - Alpha
41
+ Classifier: Intended Audience :: Science/Research
42
+ Classifier: License :: OSI Approved :: BSD License
43
+ Classifier: Programming Language :: Python :: 3
44
+ Classifier: Programming Language :: Python :: 3.12
45
+ Classifier: Programming Language :: Python :: 3.13
46
+ Classifier: Operating System :: OS Independent
47
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
48
+ Classifier: Topic :: Scientific/Engineering :: Information Analysis
49
+ Requires-Python: >=3.12
50
+ Description-Content-Type: text/markdown
51
+ License-File: LICENSE
52
+ Requires-Dist: numpy
53
+ Requires-Dist: pandas
54
+ Requires-Dist: scipy
55
+ Requires-Dist: scikit-learn>=1.5
56
+ Requires-Dist: networkx
57
+ Requires-Dist: dim-flux<1.1,>=1.0.11
58
+ Provides-Extra: docs
59
+ Requires-Dist: mkdocs-material>=9.5; extra == "docs"
60
+ Requires-Dist: mkdocstrings[python]>=0.26; extra == "docs"
61
+ Provides-Extra: dev
62
+ Requires-Dist: scikit-learn>=1.6; extra == "dev"
63
+ Requires-Dist: pytest; extra == "dev"
64
+ Requires-Dist: pytest-cov; extra == "dev"
65
+ Requires-Dist: ruff; extra == "dev"
66
+ Dynamic: license-file
67
+
68
+ # ConceptFlow
69
+
70
+ ![Python](https://img.shields.io/badge/python-3.12%2B-blue)
71
+ ![License](https://img.shields.io/badge/license-BSD--3--Clause-green)
72
+ [![Documentation](https://readthedocs.org/projects/conceptflow/badge/?version=latest)](https://conceptflow.readthedocs.io)
73
+ ![Status](https://img.shields.io/badge/status-experimental-orange)
74
+
75
+ ConceptFlow is a Python library for **Formal Concept Analysis (FCA)** that
76
+ fits into the scientific Python stack. Its machine-learning parts are proper
77
+ [scikit-learn](https://scikit-learn.org) estimators that pass scikit-learn's
78
+ estimator checks.
79
+
80
+ ```bash
81
+ pip install conceptflow
82
+ ```
83
+
84
+ Requires Python 3.12 or newer.
85
+
86
+ ## Example
87
+
88
+ ```python
89
+ import conceptflow as cf
90
+ from conceptflow.algorithms import compute_canonical_basis
91
+
92
+ # Each object has either all three attributes or exactly one.
93
+ ctx = cf.FormalContext.from_array(
94
+ [[1, 1, 1], [1, 0, 0], [0, 1, 0], [0, 0, 1]],
95
+ objects=["g1", "g2", "g3", "g4"],
96
+ attributes=["a", "b", "c"],
97
+ )
98
+
99
+ lattice = cf.ConceptLattice.from_context(ctx)
100
+ print(lattice.n_concepts) # 5
101
+
102
+ for implication in compute_canonical_basis(ctx):
103
+ print(implication.premise_names(ctx), "->", implication.conclusion_names(ctx))
104
+ # ('a', 'b') -> ('c',)
105
+ # ('a', 'c') -> ('b',)
106
+ # ('b', 'c') -> ('a',)
107
+
108
+ cf.plot_lattice(lattice, backend="tikz", layout="layered").write("lattice.pdf")
109
+ ```
110
+
111
+ ## Features
112
+
113
+ - **Formal contexts:** building and editing, clarification and reduction,
114
+ apposition, subposition, direct sum and product; `.cxt`, JSON (FCART/fcapy)
115
+ and CSV files; incomplete (yes/no/unknown) contexts.
116
+ - **Concept lattices:** NextClosure and Close-by-One on bitsets, iceberg
117
+ lattices, navigation (join, meet, up-sets, object and attribute concepts),
118
+ explicit opt-in limits for very large lattices.
119
+ - **Implications and rules:** canonical (Duquenne-Guigues) basis,
120
+ proper-premise basis, near-implications with exceptions (Luxenburger basis),
121
+ minimal generators.
122
+ - **Measures:** stability (exact and bounds), Δ-measure, entropy, information
123
+ gain, linearity and distributivity indices.
124
+ - **Conceptual scaling** of many-valued data with seven scale types and
125
+ explicit missing-value handling.
126
+ - **scikit-learn:** scaling, concept and implication features, and an
127
+ outlier detector that explains its decisions with implications.
128
+ - **Visualization:** interactive HTML, DimFlux and layered layouts,
129
+ matplotlib, Graphviz and TikZ/LaTeX export; Toscana-style nested line
130
+ diagrams.
131
+ - **Data quality:** rule violations, redundant objects and attributes,
132
+ explanations of objects and rules.
133
+
134
+ ## Documentation
135
+
136
+ The documentation is at **[conceptflow.readthedocs.io](https://conceptflow.readthedocs.io)**:
137
+
138
+ - [Getting started](https://conceptflow.readthedocs.io/en/latest/getting-started/)
139
+ - User guide: [contexts](https://conceptflow.readthedocs.io/en/latest/guide/contexts/),
140
+ [lattices](https://conceptflow.readthedocs.io/en/latest/guide/lattices/),
141
+ [implications](https://conceptflow.readthedocs.io/en/latest/guide/rules/),
142
+ [measures](https://conceptflow.readthedocs.io/en/latest/guide/measures/),
143
+ [scaling](https://conceptflow.readthedocs.io/en/latest/guide/scaling/),
144
+ [scikit-learn](https://conceptflow.readthedocs.io/en/latest/guide/sklearn/),
145
+ [visualization](https://conceptflow.readthedocs.io/en/latest/guide/visualization/),
146
+ [nested diagrams](https://conceptflow.readthedocs.io/en/latest/guide/nested/),
147
+ [data quality](https://conceptflow.readthedocs.io/en/latest/guide/quality/),
148
+ [ordinal factorization](https://conceptflow.readthedocs.io/en/latest/guide/decomposition/)
149
+ - [API reference](https://conceptflow.readthedocs.io/en/latest/api/core/)
150
+ - [Changelog](https://conceptflow.readthedocs.io/en/latest/changelog/)
151
+
152
+ The sources are in [`docs/`](https://github.com/anuragxorma/conceptflow/tree/main/docs).
153
+
154
+ To build the documentation site locally (with the API reference):
155
+
156
+ ```bash
157
+ pip install -e ".[docs]"
158
+ mkdocs serve
159
+ ```
160
+
161
+ Runnable examples, including a full case study, are in
162
+ [`examples/`](https://github.com/anuragxorma/conceptflow/tree/main/examples).
163
+
164
+ ## License
165
+
166
+ BSD 3-Clause; see [LICENSE](https://github.com/anuragxorma/conceptflow/blob/main/LICENSE).
167
+ Lattice layouts use [DimFlux](https://arxiv.org/abs/2603.16366) (the
168
+ `dim-flux` package, CC BY 4.0), installed automatically.
@@ -0,0 +1,101 @@
1
+ # ConceptFlow
2
+
3
+ ![Python](https://img.shields.io/badge/python-3.12%2B-blue)
4
+ ![License](https://img.shields.io/badge/license-BSD--3--Clause-green)
5
+ [![Documentation](https://readthedocs.org/projects/conceptflow/badge/?version=latest)](https://conceptflow.readthedocs.io)
6
+ ![Status](https://img.shields.io/badge/status-experimental-orange)
7
+
8
+ ConceptFlow is a Python library for **Formal Concept Analysis (FCA)** that
9
+ fits into the scientific Python stack. Its machine-learning parts are proper
10
+ [scikit-learn](https://scikit-learn.org) estimators that pass scikit-learn's
11
+ estimator checks.
12
+
13
+ ```bash
14
+ pip install conceptflow
15
+ ```
16
+
17
+ Requires Python 3.12 or newer.
18
+
19
+ ## Example
20
+
21
+ ```python
22
+ import conceptflow as cf
23
+ from conceptflow.algorithms import compute_canonical_basis
24
+
25
+ # Each object has either all three attributes or exactly one.
26
+ ctx = cf.FormalContext.from_array(
27
+ [[1, 1, 1], [1, 0, 0], [0, 1, 0], [0, 0, 1]],
28
+ objects=["g1", "g2", "g3", "g4"],
29
+ attributes=["a", "b", "c"],
30
+ )
31
+
32
+ lattice = cf.ConceptLattice.from_context(ctx)
33
+ print(lattice.n_concepts) # 5
34
+
35
+ for implication in compute_canonical_basis(ctx):
36
+ print(implication.premise_names(ctx), "->", implication.conclusion_names(ctx))
37
+ # ('a', 'b') -> ('c',)
38
+ # ('a', 'c') -> ('b',)
39
+ # ('b', 'c') -> ('a',)
40
+
41
+ cf.plot_lattice(lattice, backend="tikz", layout="layered").write("lattice.pdf")
42
+ ```
43
+
44
+ ## Features
45
+
46
+ - **Formal contexts:** building and editing, clarification and reduction,
47
+ apposition, subposition, direct sum and product; `.cxt`, JSON (FCART/fcapy)
48
+ and CSV files; incomplete (yes/no/unknown) contexts.
49
+ - **Concept lattices:** NextClosure and Close-by-One on bitsets, iceberg
50
+ lattices, navigation (join, meet, up-sets, object and attribute concepts),
51
+ explicit opt-in limits for very large lattices.
52
+ - **Implications and rules:** canonical (Duquenne-Guigues) basis,
53
+ proper-premise basis, near-implications with exceptions (Luxenburger basis),
54
+ minimal generators.
55
+ - **Measures:** stability (exact and bounds), Δ-measure, entropy, information
56
+ gain, linearity and distributivity indices.
57
+ - **Conceptual scaling** of many-valued data with seven scale types and
58
+ explicit missing-value handling.
59
+ - **scikit-learn:** scaling, concept and implication features, and an
60
+ outlier detector that explains its decisions with implications.
61
+ - **Visualization:** interactive HTML, DimFlux and layered layouts,
62
+ matplotlib, Graphviz and TikZ/LaTeX export; Toscana-style nested line
63
+ diagrams.
64
+ - **Data quality:** rule violations, redundant objects and attributes,
65
+ explanations of objects and rules.
66
+
67
+ ## Documentation
68
+
69
+ The documentation is at **[conceptflow.readthedocs.io](https://conceptflow.readthedocs.io)**:
70
+
71
+ - [Getting started](https://conceptflow.readthedocs.io/en/latest/getting-started/)
72
+ - User guide: [contexts](https://conceptflow.readthedocs.io/en/latest/guide/contexts/),
73
+ [lattices](https://conceptflow.readthedocs.io/en/latest/guide/lattices/),
74
+ [implications](https://conceptflow.readthedocs.io/en/latest/guide/rules/),
75
+ [measures](https://conceptflow.readthedocs.io/en/latest/guide/measures/),
76
+ [scaling](https://conceptflow.readthedocs.io/en/latest/guide/scaling/),
77
+ [scikit-learn](https://conceptflow.readthedocs.io/en/latest/guide/sklearn/),
78
+ [visualization](https://conceptflow.readthedocs.io/en/latest/guide/visualization/),
79
+ [nested diagrams](https://conceptflow.readthedocs.io/en/latest/guide/nested/),
80
+ [data quality](https://conceptflow.readthedocs.io/en/latest/guide/quality/),
81
+ [ordinal factorization](https://conceptflow.readthedocs.io/en/latest/guide/decomposition/)
82
+ - [API reference](https://conceptflow.readthedocs.io/en/latest/api/core/)
83
+ - [Changelog](https://conceptflow.readthedocs.io/en/latest/changelog/)
84
+
85
+ The sources are in [`docs/`](https://github.com/anuragxorma/conceptflow/tree/main/docs).
86
+
87
+ To build the documentation site locally (with the API reference):
88
+
89
+ ```bash
90
+ pip install -e ".[docs]"
91
+ mkdocs serve
92
+ ```
93
+
94
+ Runnable examples, including a full case study, are in
95
+ [`examples/`](https://github.com/anuragxorma/conceptflow/tree/main/examples).
96
+
97
+ ## License
98
+
99
+ BSD 3-Clause; see [LICENSE](https://github.com/anuragxorma/conceptflow/blob/main/LICENSE).
100
+ Lattice layouts use [DimFlux](https://arxiv.org/abs/2603.16366) (the
101
+ `dim-flux` package, CC BY 4.0), installed automatically.
@@ -42,6 +42,10 @@ dependencies = [
42
42
  ]
43
43
 
44
44
  [project.optional-dependencies]
45
+ docs = [
46
+ "mkdocs-material>=9.5",
47
+ "mkdocstrings[python]>=0.26",
48
+ ]
45
49
  dev = [
46
50
  # The check_estimator tests use the scikit-learn >= 1.6 API.
47
51
  "scikit-learn>=1.6",
@@ -52,6 +56,7 @@ dev = [
52
56
 
53
57
  [project.urls]
54
58
  Homepage = "https://github.com/anuragxorma/conceptflow"
59
+ Documentation = "https://conceptflow.readthedocs.io"
55
60
  Repository = "https://github.com/anuragxorma/conceptflow"
56
61
  Issues = "https://github.com/anuragxorma/conceptflow/issues"
57
62
 
@@ -0,0 +1 @@
1
+ __version__ = "0.3.1"
@@ -22,13 +22,18 @@ from conceptflow.algorithms.implications import (
22
22
  compute_canonical_basis,
23
23
  compute_canonical_basis_bruteforce,
24
24
  compute_luxenburger_basis,
25
+ compute_proper_premise_basis,
25
26
  )
27
+ from conceptflow.algorithms.generators import compute_minimal_generators
26
28
  from conceptflow.algorithms.order import strict_subconcept_of, subconcept_of
27
29
 
28
30
  from conceptflow.algorithms.reduction import (
29
31
  ClarificationResult,
32
+ ReductionResult,
30
33
  clarified_context,
31
34
  clarify_context,
35
+ reduce_context,
36
+ reduced_context,
32
37
  )
33
38
 
34
39
  __all__ = [
@@ -48,9 +53,14 @@ __all__ = [
48
53
  "compute_canonical_basis_bruteforce",
49
54
  "AssociationRule",
50
55
  "compute_luxenburger_basis",
56
+ "compute_proper_premise_basis",
57
+ "compute_minimal_generators",
51
58
  "SUPPORTED_ENUMERATION_ALGORITHMS",
52
59
  "normalize_enumeration_algorithm",
53
60
  "ClarificationResult",
54
61
  "clarified_context",
55
62
  "clarify_context",
63
+ "ReductionResult",
64
+ "reduce_context",
65
+ "reduced_context",
56
66
  ]
@@ -46,7 +46,7 @@ def normalize_enumeration_algorithm(name: str) -> str:
46
46
  ValueError
47
47
  If the algorithm is unknown.
48
48
  """
49
- normalized = name.lower().strip().replace(" ", "_")
49
+ normalized = name.lower().strip().replace(" ", "_") if isinstance(name, str) else None
50
50
 
51
51
  if normalized not in ENUMERATION_ALGORITHM_ALIASES:
52
52
  supported = ", ".join(sorted(SUPPORTED_ENUMERATION_ALGORITHMS))