conceptflow 0.3.1__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.
Files changed (143) hide show
  1. {conceptflow-0.3.1/src/conceptflow.egg-info → conceptflow-0.4.0}/PKG-INFO +21 -5
  2. {conceptflow-0.3.1 → conceptflow-0.4.0}/README.md +18 -4
  3. {conceptflow-0.3.1 → conceptflow-0.4.0}/pyproject.toml +6 -0
  4. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/__init__.py +5 -6
  5. conceptflow-0.4.0/src/conceptflow/_deprecation.py +19 -0
  6. conceptflow-0.4.0/src/conceptflow/_version.py +1 -0
  7. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/algorithms/__init__.py +7 -10
  8. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/algorithms/_bitset.py +13 -0
  9. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/algorithms/_registry.py +1 -2
  10. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/algorithms/derivation.py +1 -1
  11. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/algorithms/enumeration.py +45 -17
  12. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/algorithms/generators.py +1 -1
  13. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/algorithms/implications.py +196 -31
  14. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/algorithms/order.py +1 -1
  15. conceptflow-0.4.0/src/conceptflow/cluster/__init__.py +19 -0
  16. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/cluster/concept_lattice.py +8 -9
  17. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/core/concept.py +20 -4
  18. conceptflow-0.4.0/src/conceptflow/datasets/__init__.py +30 -0
  19. conceptflow-0.4.0/src/conceptflow/datasets/_loaders.py +302 -0
  20. conceptflow-0.4.0/src/conceptflow/datasets/data/fca_repository/README.md +9 -0
  21. conceptflow-0.4.0/src/conceptflow/datasets/data/fca_repository/animals_en.cxt +86 -0
  22. conceptflow-0.4.0/src/conceptflow/datasets/data/fca_repository/binary_relations_en.cxt +42 -0
  23. conceptflow-0.4.0/src/conceptflow/datasets/data/fca_repository/bodiesofwater_de.cxt +27 -0
  24. conceptflow-0.4.0/src/conceptflow/datasets/data/fca_repository/bodiesofwater_en.cxt +44 -0
  25. conceptflow-0.4.0/src/conceptflow/datasets/data/fca_repository/driveconcepts_de.cxt +40 -0
  26. conceptflow-0.4.0/src/conceptflow/datasets/data/fca_repository/driveconcepts_en.cxt +40 -0
  27. conceptflow-0.4.0/src/conceptflow/datasets/data/fca_repository/famous_animals_en.cxt +21 -0
  28. conceptflow-0.4.0/src/conceptflow/datasets/data/fca_repository/forum_romanum_en.cxt +40 -0
  29. conceptflow-0.4.0/src/conceptflow/datasets/data/fca_repository/livingbeings_de.cxt +30 -0
  30. conceptflow-0.4.0/src/conceptflow/datasets/data/fca_repository/livingbeings_en.cxt +30 -0
  31. conceptflow-0.4.0/src/conceptflow/datasets/data/fca_repository/missmarple_de.cxt +35 -0
  32. conceptflow-0.4.0/src/conceptflow/datasets/data/fca_repository/missmarple_en.cxt +35 -0
  33. conceptflow-0.4.0/src/conceptflow/datasets/data/fca_repository/music_en.cxt +78 -0
  34. conceptflow-0.4.0/src/conceptflow/datasets/data/fca_repository/newzealand_en.cxt +39 -0
  35. conceptflow-0.4.0/src/conceptflow/datasets/data/fca_repository/officesupplies_de.cxt +26 -0
  36. conceptflow-0.4.0/src/conceptflow/datasets/data/fca_repository/officesupplies_en.cxt +26 -0
  37. conceptflow-0.4.0/src/conceptflow/datasets/data/fca_repository/planets_en.cxt +30 -0
  38. conceptflow-0.4.0/src/conceptflow/datasets/data/fca_repository/seasoningplanner_de.cxt +154 -0
  39. conceptflow-0.4.0/src/conceptflow/datasets/data/fca_repository/tealady.cxt +55 -0
  40. conceptflow-0.4.0/src/conceptflow/datasets/data/fca_repository/triangles_en.cxt +26 -0
  41. conceptflow-0.4.0/src/conceptflow/datasets/data/fca_repository.json +204 -0
  42. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/decomposition/__init__.py +8 -3
  43. conceptflow-0.4.0/src/conceptflow/decomposition/bipartite.py +202 -0
  44. conceptflow-0.4.0/src/conceptflow/decomposition/boolean_factorization.py +371 -0
  45. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/decomposition/ordinal_factorization.py +143 -21
  46. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/exploration/view.py +1 -1
  47. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/feature_extraction/__init__.py +1 -1
  48. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/feature_extraction/concept_encoder.py +7 -3
  49. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/io/cxt.py +1 -1
  50. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/metrics/measures.py +35 -44
  51. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/preprocessing/__init__.py +1 -1
  52. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/preprocessing/conceptual_scaler.py +99 -50
  53. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/preprocessing/scales.py +37 -5
  54. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/rules/implication_basis.py +7 -3
  55. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/validation/__init__.py +1 -1
  56. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/validation/input.py +10 -0
  57. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/visualization/graph_data.py +3 -2
  58. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/visualization/html_figure.py +1 -1
  59. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/visualization/lattice_plot.py +2 -1
  60. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/visualization/nested.py +17 -7
  61. {conceptflow-0.3.1 → conceptflow-0.4.0/src/conceptflow.egg-info}/PKG-INFO +21 -5
  62. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow.egg-info/SOURCES.txt +30 -0
  63. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow.egg-info/requires.txt +1 -0
  64. {conceptflow-0.3.1 → conceptflow-0.4.0}/tests/test_algorithm_registry.py +1 -1
  65. conceptflow-0.4.0/tests/test_boolean_factorization.py +241 -0
  66. {conceptflow-0.3.1 → conceptflow-0.4.0}/tests/test_check_estimator.py +27 -0
  67. {conceptflow-0.3.1 → conceptflow-0.4.0}/tests/test_cluster_estimator.py +1 -1
  68. conceptflow-0.4.0/tests/test_concept.py +60 -0
  69. {conceptflow-0.3.1 → conceptflow-0.4.0}/tests/test_concept_encoder.py +1 -1
  70. {conceptflow-0.3.1 → conceptflow-0.4.0}/tests/test_conceptual_scaler.py +54 -2
  71. {conceptflow-0.3.1 → conceptflow-0.4.0}/tests/test_cxt_io.py +1 -1
  72. {conceptflow-0.3.1 → conceptflow-0.4.0}/tests/test_d3_backend.py +1 -1
  73. conceptflow-0.4.0/tests/test_datasets.py +183 -0
  74. {conceptflow-0.3.1 → conceptflow-0.4.0}/tests/test_derivation.py +1 -1
  75. {conceptflow-0.3.1 → conceptflow-0.4.0}/tests/test_dimflux_layout.py +3 -1
  76. {conceptflow-0.3.1 → conceptflow-0.4.0}/tests/test_exploration.py +1 -1
  77. {conceptflow-0.3.1 → conceptflow-0.4.0}/tests/test_formal_context.py +1 -1
  78. {conceptflow-0.3.1 → conceptflow-0.4.0}/tests/test_graph_data.py +1 -1
  79. {conceptflow-0.3.1 → conceptflow-0.4.0}/tests/test_html_figure.py +1 -2
  80. {conceptflow-0.3.1 → conceptflow-0.4.0}/tests/test_implications.py +28 -4
  81. {conceptflow-0.3.1 → conceptflow-0.4.0}/tests/test_lattice.py +2 -1
  82. {conceptflow-0.3.1 → conceptflow-0.4.0}/tests/test_many_valued_context.py +1 -1
  83. {conceptflow-0.3.1 → conceptflow-0.4.0}/tests/test_measures.py +6 -5
  84. {conceptflow-0.3.1 → conceptflow-0.4.0}/tests/test_metrics.py +2 -6
  85. {conceptflow-0.3.1 → conceptflow-0.4.0}/tests/test_nested_visualization.py +1 -1
  86. conceptflow-0.4.0/tests/test_ord2factor.py +168 -0
  87. {conceptflow-0.3.1 → conceptflow-0.4.0}/tests/test_ordinal_factorization.py +5 -5
  88. {conceptflow-0.3.1 → conceptflow-0.4.0}/tests/test_patch_0_3_1.py +43 -0
  89. {conceptflow-0.3.1 → conceptflow-0.4.0}/tests/test_public_api.py +5 -5
  90. {conceptflow-0.3.1 → conceptflow-0.4.0}/tests/test_reduction.py +1 -1
  91. {conceptflow-0.3.1 → conceptflow-0.4.0}/tests/test_scales.py +1 -1
  92. {conceptflow-0.3.1 → conceptflow-0.4.0}/tests/test_sklearn_compatibility.py +1 -2
  93. {conceptflow-0.3.1 → conceptflow-0.4.0}/tests/test_validation_input.py +1 -1
  94. conceptflow-0.3.1/src/conceptflow/_version.py +0 -1
  95. conceptflow-0.3.1/src/conceptflow/cluster/__init__.py +0 -22
  96. conceptflow-0.3.1/tests/test_concept.py +0 -35
  97. {conceptflow-0.3.1 → conceptflow-0.4.0}/LICENSE +0 -0
  98. {conceptflow-0.3.1 → conceptflow-0.4.0}/setup.cfg +0 -0
  99. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/algorithms/_membership.py +0 -0
  100. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/algorithms/hasse.py +0 -0
  101. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/algorithms/reduction.py +0 -0
  102. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/core/__init__.py +0 -0
  103. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/core/context.py +0 -0
  104. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/core/incomplete_context.py +0 -0
  105. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/core/lattice.py +0 -0
  106. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/core/many_valued_context.py +0 -0
  107. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/core/operations.py +0 -0
  108. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/exploration/__init__.py +0 -0
  109. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/exploration/builder.py +0 -0
  110. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/exploration/combinations.py +0 -0
  111. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/io/__init__.py +0 -0
  112. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/io/formats.py +0 -0
  113. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/metrics/__init__.py +0 -0
  114. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/metrics/rules.py +0 -0
  115. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/model_selection/__init__.py +0 -0
  116. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/quality.py +0 -0
  117. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/rules/__init__.py +0 -0
  118. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/rules/outlier_detector.py +0 -0
  119. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/visualization/__init__.py +0 -0
  120. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/visualization/d3_backend.py +0 -0
  121. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/visualization/dimflux_layout.py +0 -0
  122. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/visualization/graphviz.py +0 -0
  123. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/visualization/layered_layout.py +0 -0
  124. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/visualization/static.py +0 -0
  125. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow/visualization/tikz.py +0 -0
  126. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow.egg-info/dependency_links.txt +0 -0
  127. {conceptflow-0.3.1 → conceptflow-0.4.0}/src/conceptflow.egg-info/top_level.txt +0 -0
  128. {conceptflow-0.3.1 → conceptflow-0.4.0}/tests/test_audit_regressions.py +0 -0
  129. {conceptflow-0.3.1 → conceptflow-0.4.0}/tests/test_context_handling.py +0 -0
  130. {conceptflow-0.3.1 → conceptflow-0.4.0}/tests/test_context_operations.py +0 -0
  131. {conceptflow-0.3.1 → conceptflow-0.4.0}/tests/test_docs_examples.py +0 -0
  132. {conceptflow-0.3.1 → conceptflow-0.4.0}/tests/test_enumeration.py +1 -1
  133. {conceptflow-0.3.1 → conceptflow-0.4.0}/tests/test_generators.py +0 -0
  134. {conceptflow-0.3.1 → conceptflow-0.4.0}/tests/test_hasse.py +0 -0
  135. {conceptflow-0.3.1 → conceptflow-0.4.0}/tests/test_implication_basis_estimator.py +0 -0
  136. {conceptflow-0.3.1 → conceptflow-0.4.0}/tests/test_incomplete_context.py +0 -0
  137. {conceptflow-0.3.1 → conceptflow-0.4.0}/tests/test_lattice_navigation.py +0 -0
  138. {conceptflow-0.3.1 → conceptflow-0.4.0}/tests/test_layout_and_graphviz.py +0 -0
  139. {conceptflow-0.3.1 → conceptflow-0.4.0}/tests/test_nested_combinations.py +0 -0
  140. {conceptflow-0.3.1 → conceptflow-0.4.0}/tests/test_quality.py +0 -0
  141. {conceptflow-0.3.1 → conceptflow-0.4.0}/tests/test_review_fixes.py +0 -0
  142. {conceptflow-0.3.1 → conceptflow-0.4.0}/tests/test_static_figures.py +0 -0
  143. {conceptflow-0.3.1 → 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.1
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
@@ -43,6 +43,7 @@ Classifier: License :: OSI Approved :: BSD License
43
43
  Classifier: Programming Language :: Python :: 3
44
44
  Classifier: Programming Language :: Python :: 3.12
45
45
  Classifier: Programming Language :: Python :: 3.13
46
+ Classifier: Programming Language :: Python :: 3.14
46
47
  Classifier: Operating System :: OS Independent
47
48
  Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
48
49
  Classifier: Topic :: Scientific/Engineering :: Information Analysis
@@ -55,6 +56,7 @@ Requires-Dist: scipy
55
56
  Requires-Dist: scikit-learn>=1.5
56
57
  Requires-Dist: networkx
57
58
  Requires-Dist: dim-flux<1.1,>=1.0.11
59
+ Requires-Dist: python-sat>=1.8.dev30
58
60
  Provides-Extra: docs
59
61
  Requires-Dist: mkdocs-material>=9.5; extra == "docs"
60
62
  Requires-Dist: mkdocstrings[python]>=0.26; extra == "docs"
@@ -116,9 +118,9 @@ cf.plot_lattice(lattice, backend="tikz", layout="layered").write("lattice.pdf")
116
118
  - **Concept lattices:** NextClosure and Close-by-One on bitsets, iceberg
117
119
  lattices, navigation (join, meet, up-sets, object and attribute concepts),
118
120
  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.
121
+ - **Implications and rules:** canonical (Duquenne-Guigues) basis with
122
+ LinCbO, proper-premise basis, near-implications with exceptions (Luxenburger
123
+ basis), minimal generators.
122
124
  - **Measures:** stability (exact and bounds), Δ-measure, entropy, information
123
125
  gain, linearity and distributivity indices.
124
126
  - **Conceptual scaling** of many-valued data with seven scale types and
@@ -130,6 +132,10 @@ cf.plot_lattice(lattice, backend="tikz", layout="layered").write("lattice.pdf")
130
132
  diagrams.
131
133
  - **Data quality:** rule violations, redundant objects and attributes,
132
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.
133
139
 
134
140
  ## Documentation
135
141
 
@@ -145,8 +151,10 @@ The documentation is at **[conceptflow.readthedocs.io](https://conceptflow.readt
145
151
  [visualization](https://conceptflow.readthedocs.io/en/latest/guide/visualization/),
146
152
  [nested diagrams](https://conceptflow.readthedocs.io/en/latest/guide/nested/),
147
153
  [data quality](https://conceptflow.readthedocs.io/en/latest/guide/quality/),
148
- [ordinal factorization](https://conceptflow.readthedocs.io/en/latest/guide/decomposition/)
154
+ [factorization](https://conceptflow.readthedocs.io/en/latest/guide/decomposition/),
155
+ [datasets](https://conceptflow.readthedocs.io/en/latest/guide/datasets/)
149
156
  - [API reference](https://conceptflow.readthedocs.io/en/latest/api/core/)
157
+ - [Benchmarks against fcapy and concepts](https://conceptflow.readthedocs.io/en/latest/benchmarks/)
150
158
  - [Changelog](https://conceptflow.readthedocs.io/en/latest/changelog/)
151
159
 
152
160
  The sources are in [`docs/`](https://github.com/anuragxorma/conceptflow/tree/main/docs).
@@ -161,6 +169,14 @@ mkdocs serve
161
169
  Runnable examples, including a full case study, are in
162
170
  [`examples/`](https://github.com/anuragxorma/conceptflow/tree/main/examples).
163
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
+
164
180
  ## License
165
181
 
166
182
  BSD 3-Clause; see [LICENSE](https://github.com/anuragxorma/conceptflow/blob/main/LICENSE).
@@ -49,9 +49,9 @@ cf.plot_lattice(lattice, backend="tikz", layout="layered").write("lattice.pdf")
49
49
  - **Concept lattices:** NextClosure and Close-by-One on bitsets, iceberg
50
50
  lattices, navigation (join, meet, up-sets, object and attribute concepts),
51
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.
52
+ - **Implications and rules:** canonical (Duquenne-Guigues) basis with
53
+ LinCbO, proper-premise basis, near-implications with exceptions (Luxenburger
54
+ basis), minimal generators.
55
55
  - **Measures:** stability (exact and bounds), Δ-measure, entropy, information
56
56
  gain, linearity and distributivity indices.
57
57
  - **Conceptual scaling** of many-valued data with seven scale types and
@@ -63,6 +63,10 @@ cf.plot_lattice(lattice, backend="tikz", layout="layered").write("lattice.pdf")
63
63
  diagrams.
64
64
  - **Data quality:** rule violations, redundant objects and attributes,
65
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.
66
70
 
67
71
  ## Documentation
68
72
 
@@ -78,8 +82,10 @@ The documentation is at **[conceptflow.readthedocs.io](https://conceptflow.readt
78
82
  [visualization](https://conceptflow.readthedocs.io/en/latest/guide/visualization/),
79
83
  [nested diagrams](https://conceptflow.readthedocs.io/en/latest/guide/nested/),
80
84
  [data quality](https://conceptflow.readthedocs.io/en/latest/guide/quality/),
81
- [ordinal factorization](https://conceptflow.readthedocs.io/en/latest/guide/decomposition/)
85
+ [factorization](https://conceptflow.readthedocs.io/en/latest/guide/decomposition/),
86
+ [datasets](https://conceptflow.readthedocs.io/en/latest/guide/datasets/)
82
87
  - [API reference](https://conceptflow.readthedocs.io/en/latest/api/core/)
88
+ - [Benchmarks against fcapy and concepts](https://conceptflow.readthedocs.io/en/latest/benchmarks/)
83
89
  - [Changelog](https://conceptflow.readthedocs.io/en/latest/changelog/)
84
90
 
85
91
  The sources are in [`docs/`](https://github.com/anuragxorma/conceptflow/tree/main/docs).
@@ -94,6 +100,14 @@ mkdocs serve
94
100
  Runnable examples, including a full case study, are in
95
101
  [`examples/`](https://github.com/anuragxorma/conceptflow/tree/main/examples).
96
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
+
97
111
  ## License
98
112
 
99
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]
@@ -66,6 +69,9 @@ where = ["src"]
66
69
  [tool.setuptools]
67
70
  include-package-data = true
68
71
 
72
+ [tool.setuptools.package-data]
73
+ "conceptflow.datasets" = ["data/*.json", "data/fca_repository/*.cxt", "data/fca_repository/*.md"]
74
+
69
75
  [tool.setuptools.dynamic]
70
76
  version = { attr = "conceptflow._version.__version__" }
71
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",
@@ -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]
@@ -77,4 +77,4 @@ def attribute_closure(
77
77
  Compute B'' for a set of attribute indices B.
78
78
  """
79
79
  extent = attribute_derivation(context, attribute_indices)
80
- return object_derivation(context, extent)
80
+ return object_derivation(context, extent)
@@ -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(extent=to_indices(extent), intent=to_indices(intent))
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
- stack = [(bits.all_objects, _intent_of(bits.all_objects, columns), 0)]
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
- if intent >> j & 1:
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
- if any(
252
- not intent >> m & 1 and new_extent & columns[m] == new_extent
253
- for m in range(j)
254
- ):
255
- continue
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
- stack.append((new_extent, new_intent, j + 1))
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(extent=to_indices(extent), intent=to_indices(bits.intent(extent)))
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 {