conceptflow 0.3.0__tar.gz → 0.4.0__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.
- {conceptflow-0.3.0/src/conceptflow.egg-info → conceptflow-0.4.0}/PKG-INFO +39 -17
- {conceptflow-0.3.0 → conceptflow-0.4.0}/README.md +35 -16
- {conceptflow-0.3.0 → conceptflow-0.4.0}/pyproject.toml +7 -0
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/__init__.py +5 -6
- conceptflow-0.4.0/src/conceptflow/_deprecation.py +19 -0
- conceptflow-0.4.0/src/conceptflow/_version.py +1 -0
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/algorithms/__init__.py +7 -10
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/algorithms/_bitset.py +13 -0
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/algorithms/_registry.py +2 -3
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/algorithms/derivation.py +1 -1
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/algorithms/enumeration.py +45 -17
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/algorithms/generators.py +1 -1
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/algorithms/implications.py +206 -34
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/algorithms/order.py +1 -1
- conceptflow-0.4.0/src/conceptflow/cluster/__init__.py +19 -0
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/cluster/concept_lattice.py +8 -9
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/core/concept.py +20 -4
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/core/context.py +31 -4
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/core/incomplete_context.py +12 -3
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/core/lattice.py +15 -0
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/core/many_valued_context.py +13 -0
- conceptflow-0.4.0/src/conceptflow/datasets/__init__.py +30 -0
- conceptflow-0.4.0/src/conceptflow/datasets/_loaders.py +302 -0
- conceptflow-0.4.0/src/conceptflow/datasets/data/fca_repository/README.md +9 -0
- conceptflow-0.4.0/src/conceptflow/datasets/data/fca_repository/animals_en.cxt +86 -0
- conceptflow-0.4.0/src/conceptflow/datasets/data/fca_repository/binary_relations_en.cxt +42 -0
- conceptflow-0.4.0/src/conceptflow/datasets/data/fca_repository/bodiesofwater_de.cxt +27 -0
- conceptflow-0.4.0/src/conceptflow/datasets/data/fca_repository/bodiesofwater_en.cxt +44 -0
- conceptflow-0.4.0/src/conceptflow/datasets/data/fca_repository/driveconcepts_de.cxt +40 -0
- conceptflow-0.4.0/src/conceptflow/datasets/data/fca_repository/driveconcepts_en.cxt +40 -0
- conceptflow-0.4.0/src/conceptflow/datasets/data/fca_repository/famous_animals_en.cxt +21 -0
- conceptflow-0.4.0/src/conceptflow/datasets/data/fca_repository/forum_romanum_en.cxt +40 -0
- conceptflow-0.4.0/src/conceptflow/datasets/data/fca_repository/livingbeings_de.cxt +30 -0
- conceptflow-0.4.0/src/conceptflow/datasets/data/fca_repository/livingbeings_en.cxt +30 -0
- conceptflow-0.4.0/src/conceptflow/datasets/data/fca_repository/missmarple_de.cxt +35 -0
- conceptflow-0.4.0/src/conceptflow/datasets/data/fca_repository/missmarple_en.cxt +35 -0
- conceptflow-0.4.0/src/conceptflow/datasets/data/fca_repository/music_en.cxt +78 -0
- conceptflow-0.4.0/src/conceptflow/datasets/data/fca_repository/newzealand_en.cxt +39 -0
- conceptflow-0.4.0/src/conceptflow/datasets/data/fca_repository/officesupplies_de.cxt +26 -0
- conceptflow-0.4.0/src/conceptflow/datasets/data/fca_repository/officesupplies_en.cxt +26 -0
- conceptflow-0.4.0/src/conceptflow/datasets/data/fca_repository/planets_en.cxt +30 -0
- conceptflow-0.4.0/src/conceptflow/datasets/data/fca_repository/seasoningplanner_de.cxt +154 -0
- conceptflow-0.4.0/src/conceptflow/datasets/data/fca_repository/tealady.cxt +55 -0
- conceptflow-0.4.0/src/conceptflow/datasets/data/fca_repository/triangles_en.cxt +26 -0
- conceptflow-0.4.0/src/conceptflow/datasets/data/fca_repository.json +204 -0
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/decomposition/__init__.py +8 -3
- conceptflow-0.4.0/src/conceptflow/decomposition/bipartite.py +202 -0
- conceptflow-0.4.0/src/conceptflow/decomposition/boolean_factorization.py +371 -0
- conceptflow-0.4.0/src/conceptflow/decomposition/ordinal_factorization.py +527 -0
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/exploration/view.py +1 -1
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/feature_extraction/__init__.py +1 -1
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/feature_extraction/concept_encoder.py +9 -3
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/io/cxt.py +25 -2
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/io/formats.py +14 -5
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/metrics/measures.py +36 -45
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/metrics/rules.py +11 -4
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/preprocessing/__init__.py +1 -1
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/preprocessing/conceptual_scaler.py +112 -50
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/preprocessing/scales.py +56 -21
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/rules/implication_basis.py +22 -5
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/validation/__init__.py +1 -1
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/validation/input.py +26 -1
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/visualization/d3_backend.py +26 -13
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/visualization/dimflux_layout.py +8 -1
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/visualization/graph_data.py +34 -2
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/visualization/graphviz.py +8 -31
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/visualization/html_figure.py +10 -1
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/visualization/lattice_plot.py +2 -1
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/visualization/nested.py +32 -16
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/visualization/static.py +15 -2
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/visualization/tikz.py +10 -3
- {conceptflow-0.3.0 → conceptflow-0.4.0/src/conceptflow.egg-info}/PKG-INFO +39 -17
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow.egg-info/SOURCES.txt +31 -0
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow.egg-info/requires.txt +1 -0
- {conceptflow-0.3.0 → conceptflow-0.4.0}/tests/test_algorithm_registry.py +1 -1
- conceptflow-0.4.0/tests/test_boolean_factorization.py +241 -0
- {conceptflow-0.3.0 → conceptflow-0.4.0}/tests/test_check_estimator.py +27 -0
- {conceptflow-0.3.0 → conceptflow-0.4.0}/tests/test_cluster_estimator.py +1 -1
- conceptflow-0.4.0/tests/test_concept.py +60 -0
- {conceptflow-0.3.0 → conceptflow-0.4.0}/tests/test_concept_encoder.py +1 -1
- {conceptflow-0.3.0 → conceptflow-0.4.0}/tests/test_conceptual_scaler.py +54 -2
- {conceptflow-0.3.0 → conceptflow-0.4.0}/tests/test_cxt_io.py +1 -1
- {conceptflow-0.3.0 → conceptflow-0.4.0}/tests/test_d3_backend.py +1 -1
- conceptflow-0.4.0/tests/test_datasets.py +183 -0
- {conceptflow-0.3.0 → conceptflow-0.4.0}/tests/test_derivation.py +1 -1
- {conceptflow-0.3.0 → conceptflow-0.4.0}/tests/test_dimflux_layout.py +3 -1
- {conceptflow-0.3.0 → conceptflow-0.4.0}/tests/test_exploration.py +1 -1
- {conceptflow-0.3.0 → conceptflow-0.4.0}/tests/test_formal_context.py +1 -1
- {conceptflow-0.3.0 → conceptflow-0.4.0}/tests/test_graph_data.py +1 -1
- {conceptflow-0.3.0 → conceptflow-0.4.0}/tests/test_html_figure.py +1 -2
- {conceptflow-0.3.0 → conceptflow-0.4.0}/tests/test_implications.py +28 -4
- {conceptflow-0.3.0 → conceptflow-0.4.0}/tests/test_lattice.py +2 -1
- {conceptflow-0.3.0 → conceptflow-0.4.0}/tests/test_many_valued_context.py +1 -1
- {conceptflow-0.3.0 → conceptflow-0.4.0}/tests/test_measures.py +6 -5
- {conceptflow-0.3.0 → conceptflow-0.4.0}/tests/test_metrics.py +2 -6
- {conceptflow-0.3.0 → conceptflow-0.4.0}/tests/test_nested_visualization.py +1 -1
- conceptflow-0.4.0/tests/test_ord2factor.py +168 -0
- {conceptflow-0.3.0 → conceptflow-0.4.0}/tests/test_ordinal_factorization.py +5 -5
- conceptflow-0.4.0/tests/test_patch_0_3_1.py +330 -0
- {conceptflow-0.3.0 → conceptflow-0.4.0}/tests/test_public_api.py +5 -5
- {conceptflow-0.3.0 → conceptflow-0.4.0}/tests/test_reduction.py +1 -1
- {conceptflow-0.3.0 → conceptflow-0.4.0}/tests/test_scales.py +1 -1
- {conceptflow-0.3.0 → conceptflow-0.4.0}/tests/test_sklearn_compatibility.py +1 -2
- {conceptflow-0.3.0 → conceptflow-0.4.0}/tests/test_validation_input.py +1 -1
- conceptflow-0.3.0/src/conceptflow/_version.py +0 -1
- conceptflow-0.3.0/src/conceptflow/cluster/__init__.py +0 -22
- conceptflow-0.3.0/src/conceptflow/decomposition/ordinal_factorization.py +0 -432
- conceptflow-0.3.0/tests/test_concept.py +0 -35
- {conceptflow-0.3.0 → conceptflow-0.4.0}/LICENSE +0 -0
- {conceptflow-0.3.0 → conceptflow-0.4.0}/setup.cfg +0 -0
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/algorithms/_membership.py +0 -0
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/algorithms/hasse.py +0 -0
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/algorithms/reduction.py +0 -0
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/core/__init__.py +0 -0
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/core/operations.py +0 -0
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/exploration/__init__.py +0 -0
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/exploration/builder.py +0 -0
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/exploration/combinations.py +0 -0
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/io/__init__.py +0 -0
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/metrics/__init__.py +0 -0
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/model_selection/__init__.py +0 -0
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/quality.py +0 -0
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/rules/__init__.py +0 -0
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/rules/outlier_detector.py +0 -0
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/visualization/__init__.py +0 -0
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow/visualization/layered_layout.py +0 -0
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow.egg-info/dependency_links.txt +0 -0
- {conceptflow-0.3.0 → conceptflow-0.4.0}/src/conceptflow.egg-info/top_level.txt +0 -0
- {conceptflow-0.3.0 → conceptflow-0.4.0}/tests/test_audit_regressions.py +0 -0
- {conceptflow-0.3.0 → conceptflow-0.4.0}/tests/test_context_handling.py +0 -0
- {conceptflow-0.3.0 → conceptflow-0.4.0}/tests/test_context_operations.py +0 -0
- {conceptflow-0.3.0 → conceptflow-0.4.0}/tests/test_docs_examples.py +0 -0
- {conceptflow-0.3.0 → conceptflow-0.4.0}/tests/test_enumeration.py +1 -1
- {conceptflow-0.3.0 → conceptflow-0.4.0}/tests/test_generators.py +0 -0
- {conceptflow-0.3.0 → conceptflow-0.4.0}/tests/test_hasse.py +0 -0
- {conceptflow-0.3.0 → conceptflow-0.4.0}/tests/test_implication_basis_estimator.py +0 -0
- {conceptflow-0.3.0 → conceptflow-0.4.0}/tests/test_incomplete_context.py +0 -0
- {conceptflow-0.3.0 → conceptflow-0.4.0}/tests/test_lattice_navigation.py +0 -0
- {conceptflow-0.3.0 → conceptflow-0.4.0}/tests/test_layout_and_graphviz.py +0 -0
- {conceptflow-0.3.0 → conceptflow-0.4.0}/tests/test_nested_combinations.py +0 -0
- {conceptflow-0.3.0 → conceptflow-0.4.0}/tests/test_quality.py +0 -0
- {conceptflow-0.3.0 → conceptflow-0.4.0}/tests/test_review_fixes.py +0 -0
- {conceptflow-0.3.0 → conceptflow-0.4.0}/tests/test_static_figures.py +0 -0
- {conceptflow-0.3.0 → conceptflow-0.4.0}/tests/test_tikz.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: conceptflow
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
4
4
|
Summary: A scikit-learn compatible Formal Concept Analysis framework.
|
|
5
5
|
Author-email: Anurag Sharma <sharma@cs.uni-kassel.de>
|
|
6
6
|
License: BSD 3-Clause License
|
|
@@ -33,6 +33,7 @@ License: BSD 3-Clause License
|
|
|
33
33
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
34
34
|
|
|
35
35
|
Project-URL: Homepage, https://github.com/anuragxorma/conceptflow
|
|
36
|
+
Project-URL: Documentation, https://conceptflow.readthedocs.io
|
|
36
37
|
Project-URL: Repository, https://github.com/anuragxorma/conceptflow
|
|
37
38
|
Project-URL: Issues, https://github.com/anuragxorma/conceptflow/issues
|
|
38
39
|
Keywords: formal-concept-analysis,fca,scikit-learn,concept-lattice,conceptual-scaling
|
|
@@ -42,6 +43,7 @@ Classifier: License :: OSI Approved :: BSD License
|
|
|
42
43
|
Classifier: Programming Language :: Python :: 3
|
|
43
44
|
Classifier: Programming Language :: Python :: 3.12
|
|
44
45
|
Classifier: Programming Language :: Python :: 3.13
|
|
46
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
45
47
|
Classifier: Operating System :: OS Independent
|
|
46
48
|
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
47
49
|
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
@@ -54,6 +56,7 @@ Requires-Dist: scipy
|
|
|
54
56
|
Requires-Dist: scikit-learn>=1.5
|
|
55
57
|
Requires-Dist: networkx
|
|
56
58
|
Requires-Dist: dim-flux<1.1,>=1.0.11
|
|
59
|
+
Requires-Dist: python-sat>=1.8.dev30
|
|
57
60
|
Provides-Extra: docs
|
|
58
61
|
Requires-Dist: mkdocs-material>=9.5; extra == "docs"
|
|
59
62
|
Requires-Dist: mkdocstrings[python]>=0.26; extra == "docs"
|
|
@@ -68,6 +71,7 @@ Dynamic: license-file
|
|
|
68
71
|
|
|
69
72
|

|
|
70
73
|

|
|
74
|
+
[](https://conceptflow.readthedocs.io)
|
|
71
75
|

|
|
72
76
|
|
|
73
77
|
ConceptFlow is a Python library for **Formal Concept Analysis (FCA)** that
|
|
@@ -114,9 +118,9 @@ cf.plot_lattice(lattice, backend="tikz", layout="layered").write("lattice.pdf")
|
|
|
114
118
|
- **Concept lattices:** NextClosure and Close-by-One on bitsets, iceberg
|
|
115
119
|
lattices, navigation (join, meet, up-sets, object and attribute concepts),
|
|
116
120
|
explicit opt-in limits for very large lattices.
|
|
117
|
-
- **Implications and rules:** canonical (Duquenne-Guigues) basis
|
|
118
|
-
proper-premise basis, near-implications with exceptions (Luxenburger
|
|
119
|
-
minimal generators.
|
|
121
|
+
- **Implications and rules:** canonical (Duquenne-Guigues) basis with
|
|
122
|
+
LinCbO, proper-premise basis, near-implications with exceptions (Luxenburger
|
|
123
|
+
basis), minimal generators.
|
|
120
124
|
- **Measures:** stability (exact and bounds), Δ-measure, entropy, information
|
|
121
125
|
gain, linearity and distributivity indices.
|
|
122
126
|
- **Conceptual scaling** of many-valued data with seven scale types and
|
|
@@ -128,22 +132,32 @@ cf.plot_lattice(lattice, backend="tikz", layout="layered").write("lattice.pdf")
|
|
|
128
132
|
diagrams.
|
|
129
133
|
- **Data quality:** rule violations, redundant objects and attributes,
|
|
130
134
|
explanations of objects and rules.
|
|
135
|
+
- **Factorization:** Boolean matrix factorization (GreConD, ASSO) as
|
|
136
|
+
scikit-learn transformers; ordinal two-factorization.
|
|
137
|
+
- **Datasets:** the 20 contexts of the FCA repository (bundled), the UCI
|
|
138
|
+
Mushroom data and random contexts.
|
|
131
139
|
|
|
132
140
|
## Documentation
|
|
133
141
|
|
|
134
|
-
The documentation
|
|
135
|
-
|
|
136
|
-
- [Getting started](https://
|
|
137
|
-
- User guide: [contexts](https://
|
|
138
|
-
[lattices](https://
|
|
139
|
-
[implications](https://
|
|
140
|
-
[measures](https://
|
|
141
|
-
[scaling](https://
|
|
142
|
-
[scikit-learn](https://
|
|
143
|
-
[visualization](https://
|
|
144
|
-
[nested diagrams](https://
|
|
145
|
-
[data quality](https://
|
|
146
|
-
|
|
142
|
+
The documentation is at **[conceptflow.readthedocs.io](https://conceptflow.readthedocs.io)**:
|
|
143
|
+
|
|
144
|
+
- [Getting started](https://conceptflow.readthedocs.io/en/latest/getting-started/)
|
|
145
|
+
- User guide: [contexts](https://conceptflow.readthedocs.io/en/latest/guide/contexts/),
|
|
146
|
+
[lattices](https://conceptflow.readthedocs.io/en/latest/guide/lattices/),
|
|
147
|
+
[implications](https://conceptflow.readthedocs.io/en/latest/guide/rules/),
|
|
148
|
+
[measures](https://conceptflow.readthedocs.io/en/latest/guide/measures/),
|
|
149
|
+
[scaling](https://conceptflow.readthedocs.io/en/latest/guide/scaling/),
|
|
150
|
+
[scikit-learn](https://conceptflow.readthedocs.io/en/latest/guide/sklearn/),
|
|
151
|
+
[visualization](https://conceptflow.readthedocs.io/en/latest/guide/visualization/),
|
|
152
|
+
[nested diagrams](https://conceptflow.readthedocs.io/en/latest/guide/nested/),
|
|
153
|
+
[data quality](https://conceptflow.readthedocs.io/en/latest/guide/quality/),
|
|
154
|
+
[factorization](https://conceptflow.readthedocs.io/en/latest/guide/decomposition/),
|
|
155
|
+
[datasets](https://conceptflow.readthedocs.io/en/latest/guide/datasets/)
|
|
156
|
+
- [API reference](https://conceptflow.readthedocs.io/en/latest/api/core/)
|
|
157
|
+
- [Benchmarks against fcapy and concepts](https://conceptflow.readthedocs.io/en/latest/benchmarks/)
|
|
158
|
+
- [Changelog](https://conceptflow.readthedocs.io/en/latest/changelog/)
|
|
159
|
+
|
|
160
|
+
The sources are in [`docs/`](https://github.com/anuragxorma/conceptflow/tree/main/docs).
|
|
147
161
|
|
|
148
162
|
To build the documentation site locally (with the API reference):
|
|
149
163
|
|
|
@@ -155,6 +169,14 @@ mkdocs serve
|
|
|
155
169
|
Runnable examples, including a full case study, are in
|
|
156
170
|
[`examples/`](https://github.com/anuragxorma/conceptflow/tree/main/examples).
|
|
157
171
|
|
|
172
|
+
## Citing and contributing
|
|
173
|
+
|
|
174
|
+
If you use ConceptFlow in your research, please cite it; see
|
|
175
|
+
[CITATION.cff](https://github.com/anuragxorma/conceptflow/blob/main/CITATION.cff)
|
|
176
|
+
(or GitHub's "Cite this repository" button). Questions, bug reports and
|
|
177
|
+
contributions are welcome; see
|
|
178
|
+
[CONTRIBUTING.md](https://github.com/anuragxorma/conceptflow/blob/main/CONTRIBUTING.md).
|
|
179
|
+
|
|
158
180
|
## License
|
|
159
181
|
|
|
160
182
|
BSD 3-Clause; see [LICENSE](https://github.com/anuragxorma/conceptflow/blob/main/LICENSE).
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|

|
|
4
4
|

|
|
5
|
+
[](https://conceptflow.readthedocs.io)
|
|
5
6
|

|
|
6
7
|
|
|
7
8
|
ConceptFlow is a Python library for **Formal Concept Analysis (FCA)** that
|
|
@@ -48,9 +49,9 @@ cf.plot_lattice(lattice, backend="tikz", layout="layered").write("lattice.pdf")
|
|
|
48
49
|
- **Concept lattices:** NextClosure and Close-by-One on bitsets, iceberg
|
|
49
50
|
lattices, navigation (join, meet, up-sets, object and attribute concepts),
|
|
50
51
|
explicit opt-in limits for very large lattices.
|
|
51
|
-
- **Implications and rules:** canonical (Duquenne-Guigues) basis
|
|
52
|
-
proper-premise basis, near-implications with exceptions (Luxenburger
|
|
53
|
-
minimal generators.
|
|
52
|
+
- **Implications and rules:** canonical (Duquenne-Guigues) basis with
|
|
53
|
+
LinCbO, proper-premise basis, near-implications with exceptions (Luxenburger
|
|
54
|
+
basis), minimal generators.
|
|
54
55
|
- **Measures:** stability (exact and bounds), Δ-measure, entropy, information
|
|
55
56
|
gain, linearity and distributivity indices.
|
|
56
57
|
- **Conceptual scaling** of many-valued data with seven scale types and
|
|
@@ -62,22 +63,32 @@ cf.plot_lattice(lattice, backend="tikz", layout="layered").write("lattice.pdf")
|
|
|
62
63
|
diagrams.
|
|
63
64
|
- **Data quality:** rule violations, redundant objects and attributes,
|
|
64
65
|
explanations of objects and rules.
|
|
66
|
+
- **Factorization:** Boolean matrix factorization (GreConD, ASSO) as
|
|
67
|
+
scikit-learn transformers; ordinal two-factorization.
|
|
68
|
+
- **Datasets:** the 20 contexts of the FCA repository (bundled), the UCI
|
|
69
|
+
Mushroom data and random contexts.
|
|
65
70
|
|
|
66
71
|
## Documentation
|
|
67
72
|
|
|
68
|
-
The documentation
|
|
69
|
-
|
|
70
|
-
- [Getting started](https://
|
|
71
|
-
- User guide: [contexts](https://
|
|
72
|
-
[lattices](https://
|
|
73
|
-
[implications](https://
|
|
74
|
-
[measures](https://
|
|
75
|
-
[scaling](https://
|
|
76
|
-
[scikit-learn](https://
|
|
77
|
-
[visualization](https://
|
|
78
|
-
[nested diagrams](https://
|
|
79
|
-
[data quality](https://
|
|
80
|
-
|
|
73
|
+
The documentation is at **[conceptflow.readthedocs.io](https://conceptflow.readthedocs.io)**:
|
|
74
|
+
|
|
75
|
+
- [Getting started](https://conceptflow.readthedocs.io/en/latest/getting-started/)
|
|
76
|
+
- User guide: [contexts](https://conceptflow.readthedocs.io/en/latest/guide/contexts/),
|
|
77
|
+
[lattices](https://conceptflow.readthedocs.io/en/latest/guide/lattices/),
|
|
78
|
+
[implications](https://conceptflow.readthedocs.io/en/latest/guide/rules/),
|
|
79
|
+
[measures](https://conceptflow.readthedocs.io/en/latest/guide/measures/),
|
|
80
|
+
[scaling](https://conceptflow.readthedocs.io/en/latest/guide/scaling/),
|
|
81
|
+
[scikit-learn](https://conceptflow.readthedocs.io/en/latest/guide/sklearn/),
|
|
82
|
+
[visualization](https://conceptflow.readthedocs.io/en/latest/guide/visualization/),
|
|
83
|
+
[nested diagrams](https://conceptflow.readthedocs.io/en/latest/guide/nested/),
|
|
84
|
+
[data quality](https://conceptflow.readthedocs.io/en/latest/guide/quality/),
|
|
85
|
+
[factorization](https://conceptflow.readthedocs.io/en/latest/guide/decomposition/),
|
|
86
|
+
[datasets](https://conceptflow.readthedocs.io/en/latest/guide/datasets/)
|
|
87
|
+
- [API reference](https://conceptflow.readthedocs.io/en/latest/api/core/)
|
|
88
|
+
- [Benchmarks against fcapy and concepts](https://conceptflow.readthedocs.io/en/latest/benchmarks/)
|
|
89
|
+
- [Changelog](https://conceptflow.readthedocs.io/en/latest/changelog/)
|
|
90
|
+
|
|
91
|
+
The sources are in [`docs/`](https://github.com/anuragxorma/conceptflow/tree/main/docs).
|
|
81
92
|
|
|
82
93
|
To build the documentation site locally (with the API reference):
|
|
83
94
|
|
|
@@ -89,6 +100,14 @@ mkdocs serve
|
|
|
89
100
|
Runnable examples, including a full case study, are in
|
|
90
101
|
[`examples/`](https://github.com/anuragxorma/conceptflow/tree/main/examples).
|
|
91
102
|
|
|
103
|
+
## Citing and contributing
|
|
104
|
+
|
|
105
|
+
If you use ConceptFlow in your research, please cite it; see
|
|
106
|
+
[CITATION.cff](https://github.com/anuragxorma/conceptflow/blob/main/CITATION.cff)
|
|
107
|
+
(or GitHub's "Cite this repository" button). Questions, bug reports and
|
|
108
|
+
contributions are welcome; see
|
|
109
|
+
[CONTRIBUTING.md](https://github.com/anuragxorma/conceptflow/blob/main/CONTRIBUTING.md).
|
|
110
|
+
|
|
92
111
|
## License
|
|
93
112
|
|
|
94
113
|
BSD 3-Clause; see [LICENSE](https://github.com/anuragxorma/conceptflow/blob/main/LICENSE).
|
|
@@ -26,6 +26,7 @@ classifiers = [
|
|
|
26
26
|
"Programming Language :: Python :: 3",
|
|
27
27
|
"Programming Language :: Python :: 3.12",
|
|
28
28
|
"Programming Language :: Python :: 3.13",
|
|
29
|
+
"Programming Language :: Python :: 3.14",
|
|
29
30
|
"Operating System :: OS Independent",
|
|
30
31
|
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
31
32
|
"Topic :: Scientific/Engineering :: Information Analysis",
|
|
@@ -39,6 +40,8 @@ dependencies = [
|
|
|
39
40
|
# dimflux_layout uses DimFlux's pipeline classes directly, not only its
|
|
40
41
|
# public plot(), so stay within the tested minor version.
|
|
41
42
|
"dim-flux>=1.0.11,<1.1",
|
|
43
|
+
# SAT solver (MiniSat 2.2) for Ord2Factor's exact method.
|
|
44
|
+
"python-sat>=1.8.dev30",
|
|
42
45
|
]
|
|
43
46
|
|
|
44
47
|
[project.optional-dependencies]
|
|
@@ -56,6 +59,7 @@ dev = [
|
|
|
56
59
|
|
|
57
60
|
[project.urls]
|
|
58
61
|
Homepage = "https://github.com/anuragxorma/conceptflow"
|
|
62
|
+
Documentation = "https://conceptflow.readthedocs.io"
|
|
59
63
|
Repository = "https://github.com/anuragxorma/conceptflow"
|
|
60
64
|
Issues = "https://github.com/anuragxorma/conceptflow/issues"
|
|
61
65
|
|
|
@@ -65,6 +69,9 @@ where = ["src"]
|
|
|
65
69
|
[tool.setuptools]
|
|
66
70
|
include-package-data = true
|
|
67
71
|
|
|
72
|
+
[tool.setuptools.package-data]
|
|
73
|
+
"conceptflow.datasets" = ["data/*.json", "data/fca_repository/*.cxt", "data/fca_repository/*.md"]
|
|
74
|
+
|
|
68
75
|
[tool.setuptools.dynamic]
|
|
69
76
|
version = { attr = "conceptflow._version.__version__" }
|
|
70
77
|
|
|
@@ -12,6 +12,10 @@ from conceptflow.core import (
|
|
|
12
12
|
IncompleteContext,
|
|
13
13
|
ManyValuedContext,
|
|
14
14
|
)
|
|
15
|
+
from conceptflow.exploration import (
|
|
16
|
+
ExplorationBuilder,
|
|
17
|
+
ExplorationView,
|
|
18
|
+
)
|
|
15
19
|
from conceptflow.visualization import (
|
|
16
20
|
GraphData,
|
|
17
21
|
GraphEdge,
|
|
@@ -20,11 +24,6 @@ from conceptflow.visualization import (
|
|
|
20
24
|
plot_lattice,
|
|
21
25
|
)
|
|
22
26
|
|
|
23
|
-
from conceptflow.exploration import (
|
|
24
|
-
ExplorationBuilder,
|
|
25
|
-
ExplorationView,
|
|
26
|
-
)
|
|
27
|
-
|
|
28
27
|
__all__ = [
|
|
29
28
|
"__version__",
|
|
30
29
|
"Concept",
|
|
@@ -39,4 +38,4 @@ __all__ = [
|
|
|
39
38
|
"plot_lattice",
|
|
40
39
|
"ExplorationBuilder",
|
|
41
40
|
"ExplorationView",
|
|
42
|
-
]
|
|
41
|
+
]
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Deprecation warnings, following the policy in docs/api-stability.md: a
|
|
3
|
+
deprecated name keeps working for at least one minor release and says what
|
|
4
|
+
replaces it and in which version it will be removed.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import warnings
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def warn_deprecated(old: str, new: str, removal: str, stacklevel: int = 3) -> None:
|
|
13
|
+
"""Warn that ``old`` is deprecated in favour of ``new`` until ``removal``."""
|
|
14
|
+
warnings.warn(
|
|
15
|
+
f"{old} is deprecated; use {new} instead. It will be removed in "
|
|
16
|
+
f"ConceptFlow {removal}.",
|
|
17
|
+
DeprecationWarning,
|
|
18
|
+
stacklevel=stacklevel,
|
|
19
|
+
)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.4.0"
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
from conceptflow.algorithms._registry import (
|
|
2
|
+
SUPPORTED_ENUMERATION_ALGORITHMS,
|
|
3
|
+
normalize_enumeration_algorithm,
|
|
4
|
+
)
|
|
1
5
|
from conceptflow.algorithms.derivation import (
|
|
2
6
|
attribute_closure,
|
|
3
7
|
attribute_derivation,
|
|
@@ -6,15 +10,10 @@ from conceptflow.algorithms.derivation import (
|
|
|
6
10
|
from conceptflow.algorithms.enumeration import (
|
|
7
11
|
enumerate_concepts,
|
|
8
12
|
enumerate_concepts_bruteforce,
|
|
9
|
-
enumerate_concepts_nextclosure,
|
|
10
13
|
enumerate_concepts_closebyone,
|
|
14
|
+
enumerate_concepts_nextclosure,
|
|
11
15
|
)
|
|
12
|
-
|
|
13
|
-
from conceptflow.algorithms._registry import (
|
|
14
|
-
SUPPORTED_ENUMERATION_ALGORITHMS,
|
|
15
|
-
normalize_enumeration_algorithm,
|
|
16
|
-
)
|
|
17
|
-
|
|
16
|
+
from conceptflow.algorithms.generators import compute_minimal_generators
|
|
18
17
|
from conceptflow.algorithms.hasse import compute_hasse_edges, is_cover
|
|
19
18
|
from conceptflow.algorithms.implications import (
|
|
20
19
|
AssociationRule,
|
|
@@ -24,9 +23,7 @@ from conceptflow.algorithms.implications import (
|
|
|
24
23
|
compute_luxenburger_basis,
|
|
25
24
|
compute_proper_premise_basis,
|
|
26
25
|
)
|
|
27
|
-
from conceptflow.algorithms.generators import compute_minimal_generators
|
|
28
26
|
from conceptflow.algorithms.order import strict_subconcept_of, subconcept_of
|
|
29
|
-
|
|
30
27
|
from conceptflow.algorithms.reduction import (
|
|
31
28
|
ClarificationResult,
|
|
32
29
|
ReductionResult,
|
|
@@ -63,4 +60,4 @@ __all__ = [
|
|
|
63
60
|
"ReductionResult",
|
|
64
61
|
"reduce_context",
|
|
65
62
|
"reduced_context",
|
|
66
|
-
]
|
|
63
|
+
]
|
|
@@ -23,6 +23,14 @@ from conceptflow.core.context import FormalContext
|
|
|
23
23
|
|
|
24
24
|
def from_indices(indices: Iterable[int]) -> int:
|
|
25
25
|
"""Encode an iterable of indices as a bitset."""
|
|
26
|
+
if isinstance(indices, (frozenset, set)) and len(indices) > 32:
|
|
27
|
+
# Large sets: build the bytes with NumPy instead of one shift per index.
|
|
28
|
+
positions = np.fromiter(indices, dtype=np.int64, count=len(indices))
|
|
29
|
+
if positions.min() < 0:
|
|
30
|
+
raise ValueError("Bitset indices must be non-negative.")
|
|
31
|
+
bools = np.zeros(int(positions.max()) + 1, dtype=bool)
|
|
32
|
+
bools[positions] = True
|
|
33
|
+
return int.from_bytes(np.packbits(bools, bitorder="little").tobytes(), "little")
|
|
26
34
|
mask = 0
|
|
27
35
|
for index in indices:
|
|
28
36
|
# operator.index: a numpy integer here would turn the mask into a
|
|
@@ -33,6 +41,11 @@ def from_indices(indices: Iterable[int]) -> int:
|
|
|
33
41
|
|
|
34
42
|
def to_indices(mask: int) -> frozenset[int]:
|
|
35
43
|
"""Decode a bitset into a frozenset of indices."""
|
|
44
|
+
if mask.bit_count() > 32:
|
|
45
|
+
# Large sets (e.g. extents of thousands of objects): unpack the bytes
|
|
46
|
+
# with NumPy instead of looping over the bits in Python.
|
|
47
|
+
raw = np.frombuffer(mask.to_bytes((mask.bit_length() + 7) // 8, "little"), np.uint8)
|
|
48
|
+
return frozenset(np.flatnonzero(np.unpackbits(raw, bitorder="little")).tolist())
|
|
36
49
|
indices = []
|
|
37
50
|
while mask:
|
|
38
51
|
low = mask & -mask
|
|
@@ -8,7 +8,6 @@ string logic across the codebase.
|
|
|
8
8
|
|
|
9
9
|
from __future__ import annotations
|
|
10
10
|
|
|
11
|
-
|
|
12
11
|
ENUMERATION_ALGORITHM_ALIASES = {
|
|
13
12
|
"bruteforce": "bruteforce",
|
|
14
13
|
"brute_force": "bruteforce",
|
|
@@ -46,7 +45,7 @@ def normalize_enumeration_algorithm(name: str) -> str:
|
|
|
46
45
|
ValueError
|
|
47
46
|
If the algorithm is unknown.
|
|
48
47
|
"""
|
|
49
|
-
normalized = name.lower().strip().replace(" ", "_")
|
|
48
|
+
normalized = name.lower().strip().replace(" ", "_") if isinstance(name, str) else None
|
|
50
49
|
|
|
51
50
|
if normalized not in ENUMERATION_ALGORITHM_ALIASES:
|
|
52
51
|
supported = ", ".join(sorted(SUPPORTED_ENUMERATION_ALGORITHMS))
|
|
@@ -55,4 +54,4 @@ def normalize_enumeration_algorithm(name: str) -> str:
|
|
|
55
54
|
f"Supported algorithms are: {supported}."
|
|
56
55
|
)
|
|
57
56
|
|
|
58
|
-
return ENUMERATION_ALGORITHM_ALIASES[normalized]
|
|
57
|
+
return ENUMERATION_ALGORITHM_ALIASES[normalized]
|
|
@@ -22,7 +22,7 @@ import warnings
|
|
|
22
22
|
from collections.abc import Iterable
|
|
23
23
|
from itertools import chain, combinations
|
|
24
24
|
|
|
25
|
-
from conceptflow.algorithms._bitset import BitsetContext, to_indices
|
|
25
|
+
from conceptflow.algorithms._bitset import BitsetContext, iter_bits, to_indices
|
|
26
26
|
from conceptflow.algorithms._registry import normalize_enumeration_algorithm
|
|
27
27
|
from conceptflow.algorithms.derivation import (
|
|
28
28
|
attribute_closure,
|
|
@@ -155,7 +155,7 @@ def _intent_of(extent: int, columns: list[int]) -> int:
|
|
|
155
155
|
|
|
156
156
|
|
|
157
157
|
def _to_concept(extent: int, intent: int) -> Concept:
|
|
158
|
-
return Concept(
|
|
158
|
+
return Concept._from_indices(to_indices(extent), to_indices(intent))
|
|
159
159
|
|
|
160
160
|
|
|
161
161
|
def enumerate_concepts_nextclosure(
|
|
@@ -215,13 +215,37 @@ def _closebyone_bitsets(
|
|
|
215
215
|
"""
|
|
216
216
|
Close-by-One on integer bitsets; returns ``(extent, intent)`` pairs.
|
|
217
217
|
|
|
218
|
+
Uses FCbO's pruning (Krajča, Outrata and Vychodil, "Advances in
|
|
219
|
+
algorithms based on CbO", CLA 2010): when extending a concept by ``j``
|
|
220
|
+
fails the canonicity test, the failed intent is remembered and passed
|
|
221
|
+
to the children; a child skips ``j`` without computing anything if the
|
|
222
|
+
remembered intent would fail again (it has an attribute below ``j`` that
|
|
223
|
+
the child's intent lacks).
|
|
224
|
+
|
|
218
225
|
Concepts with fewer than ``min_extent_size`` objects are pruned with
|
|
219
226
|
their whole subtree: extending a concept only shrinks its extent, and a
|
|
220
227
|
concept's canonical generation path runs through larger extents only,
|
|
221
228
|
so no concept above the threshold is lost.
|
|
222
229
|
"""
|
|
223
230
|
columns = bits.columns
|
|
231
|
+
rows = bits.rows
|
|
224
232
|
n_attributes = bits.n_attributes
|
|
233
|
+
all_attributes = bits.all_attributes
|
|
234
|
+
|
|
235
|
+
def intent_of(extent: int, known: int) -> int:
|
|
236
|
+
# Intersect the rows of the extent's objects when there are few of
|
|
237
|
+
# them; otherwise test each remaining attribute's column.
|
|
238
|
+
rest = all_attributes & ~known
|
|
239
|
+
if extent.bit_count() < 2 * rest.bit_count():
|
|
240
|
+
result = all_attributes
|
|
241
|
+
for g in iter_bits(extent):
|
|
242
|
+
result &= rows[g]
|
|
243
|
+
return result | known
|
|
244
|
+
result = known
|
|
245
|
+
for m in iter_bits(rest):
|
|
246
|
+
if not extent & ~columns[m]:
|
|
247
|
+
result |= 1 << m
|
|
248
|
+
return result
|
|
225
249
|
|
|
226
250
|
if bits.n_objects < min_extent_size:
|
|
227
251
|
# Not even the top concept is frequent; it is still returned, so an
|
|
@@ -231,35 +255,39 @@ def _closebyone_bitsets(
|
|
|
231
255
|
return [(bits.all_objects, _intent_of(bits.all_objects, columns))]
|
|
232
256
|
|
|
233
257
|
found: list[tuple[int, int]] = []
|
|
234
|
-
|
|
258
|
+
# Frames: extent, intent, first attribute to try, failed intents per attribute.
|
|
259
|
+
stack = [(bits.all_objects, _intent_of(bits.all_objects, columns), 0, [0] * n_attributes)]
|
|
235
260
|
|
|
236
261
|
while stack:
|
|
237
|
-
extent, intent, start = stack.pop()
|
|
262
|
+
extent, intent, start, failed = stack.pop()
|
|
238
263
|
if guard is not None:
|
|
239
264
|
guard.tick()
|
|
240
265
|
found.append((extent, intent))
|
|
266
|
+
if intent == all_attributes:
|
|
267
|
+
continue
|
|
241
268
|
|
|
269
|
+
failed = list(failed)
|
|
270
|
+
children = []
|
|
242
271
|
for j in range(start, n_attributes):
|
|
243
|
-
|
|
272
|
+
bit = 1 << j
|
|
273
|
+
if intent & bit:
|
|
244
274
|
continue
|
|
275
|
+
below = bit - 1
|
|
276
|
+
if failed[j] & below & ~intent:
|
|
277
|
+
continue # fails canonicity again (FCbO)
|
|
245
278
|
|
|
246
279
|
new_extent = extent & columns[j]
|
|
247
|
-
|
|
248
280
|
if new_extent.bit_count() < min_extent_size:
|
|
249
281
|
continue
|
|
250
282
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
new_intent = intent | (1 << j)
|
|
258
|
-
for m in range(j + 1, n_attributes):
|
|
259
|
-
if not new_intent >> m & 1 and new_extent & columns[m] == new_extent:
|
|
260
|
-
new_intent |= 1 << m
|
|
283
|
+
new_intent = intent_of(new_extent, intent | bit)
|
|
284
|
+
if new_intent & below & ~intent:
|
|
285
|
+
failed[j] = new_intent # not canonical: generated elsewhere
|
|
286
|
+
else:
|
|
287
|
+
children.append((new_extent, new_intent, j + 1))
|
|
261
288
|
|
|
262
|
-
|
|
289
|
+
for new_extent, new_intent, next_start in reversed(children):
|
|
290
|
+
stack.append((new_extent, new_intent, next_start, failed))
|
|
263
291
|
|
|
264
292
|
return found
|
|
265
293
|
|
|
@@ -68,7 +68,7 @@ def compute_minimal_generators(
|
|
|
68
68
|
generators: dict[Concept, list[frozenset[int]]] = {}
|
|
69
69
|
|
|
70
70
|
for key, extent in _keys_with_extents(bits).items():
|
|
71
|
-
concept = Concept(
|
|
71
|
+
concept = Concept._from_indices(to_indices(extent), to_indices(bits.intent(extent)))
|
|
72
72
|
generators.setdefault(concept, []).append(to_indices(key))
|
|
73
73
|
|
|
74
74
|
return {
|