compiled-knowledge 4.1.0a1__tar.gz → 4.1.0a2__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.

Potentially problematic release.


This version of compiled-knowledge might be problematic. Click here for more details.

Files changed (198) hide show
  1. {compiled_knowledge-4.1.0a1/src/compiled_knowledge.egg-info → compiled_knowledge-4.1.0a2}/PKG-INFO +1 -1
  2. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/pyproject.toml +1 -1
  3. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/dataset/cross_table.py +2 -2
  4. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/dataset/dataset.py +50 -33
  5. compiled_knowledge-4.1.0a2/src/ck/dataset/dataset_builder.py +512 -0
  6. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/dataset/dataset_from_csv.py +5 -1
  7. compiled_knowledge-4.1.0a2/src/ck_demos/dataset/demo_dataset_builder.py +37 -0
  8. compiled_knowledge-4.1.0a2/src/ck_demos/utils/__init__.py +0 -0
  9. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2/src/compiled_knowledge.egg-info}/PKG-INFO +1 -1
  10. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/compiled_knowledge.egg-info/SOURCES.txt +3 -0
  11. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/LICENSE.txt +0 -0
  12. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/MANIFEST.in +0 -0
  13. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/README.md +0 -0
  14. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/setup.cfg +0 -0
  15. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/setup.py +0 -0
  16. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/__init__.py +0 -0
  17. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/circuit/__init__.py +0 -0
  18. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/circuit/_circuit_cy.c +0 -0
  19. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/circuit/_circuit_cy.pxd +0 -0
  20. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/circuit/_circuit_cy.pyx +0 -0
  21. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/circuit/_circuit_py.py +0 -0
  22. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/circuit/tmp_const.py +0 -0
  23. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/circuit_compiler/__init__.py +0 -0
  24. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/circuit_compiler/circuit_compiler.py +0 -0
  25. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/circuit_compiler/cython_vm_compiler/__init__.py +0 -0
  26. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/circuit_compiler/cython_vm_compiler/_compiler.c +0 -0
  27. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/circuit_compiler/cython_vm_compiler/_compiler.pyx +0 -0
  28. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/circuit_compiler/cython_vm_compiler/cython_vm_compiler.py +0 -0
  29. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/circuit_compiler/interpret_compiler.py +0 -0
  30. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/circuit_compiler/llvm_compiler.py +0 -0
  31. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/circuit_compiler/llvm_vm_compiler.py +0 -0
  32. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/circuit_compiler/named_circuit_compilers.py +0 -0
  33. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/circuit_compiler/support/__init__.py +0 -0
  34. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/circuit_compiler/support/circuit_analyser/__init__.py +0 -0
  35. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/circuit_compiler/support/circuit_analyser/_circuit_analyser_cy.c +0 -0
  36. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/circuit_compiler/support/circuit_analyser/_circuit_analyser_cy.pyx +0 -0
  37. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/circuit_compiler/support/circuit_analyser/_circuit_analyser_py.py +0 -0
  38. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/circuit_compiler/support/input_vars.py +0 -0
  39. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/circuit_compiler/support/llvm_ir_function.py +0 -0
  40. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/dataset/__init__.py +0 -0
  41. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/dataset/cross_table_probabilities.py +0 -0
  42. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/dataset/dataset_compute.py +0 -0
  43. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/dataset/dataset_from_crosstable.py +0 -0
  44. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/dataset/sampled_dataset.py +0 -0
  45. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/example/__init__.py +0 -0
  46. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/example/alarm.py +0 -0
  47. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/example/asia.py +0 -0
  48. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/example/binary_clique.py +0 -0
  49. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/example/bow_tie.py +0 -0
  50. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/example/cancer.py +0 -0
  51. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/example/chain.py +0 -0
  52. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/example/child.py +0 -0
  53. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/example/clique.py +0 -0
  54. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/example/cnf_pgm.py +0 -0
  55. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/example/diamond_square.py +0 -0
  56. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/example/earthquake.py +0 -0
  57. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/example/empty.py +0 -0
  58. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/example/hailfinder.py +0 -0
  59. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/example/hepar2.py +0 -0
  60. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/example/insurance.py +0 -0
  61. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/example/loop.py +0 -0
  62. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/example/mildew.py +0 -0
  63. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/example/munin.py +0 -0
  64. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/example/pathfinder.py +0 -0
  65. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/example/rain.py +0 -0
  66. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/example/rectangle.py +0 -0
  67. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/example/run.py +0 -0
  68. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/example/sachs.py +0 -0
  69. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/example/sprinkler.py +0 -0
  70. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/example/star.py +0 -0
  71. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/example/stress.py +0 -0
  72. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/example/student.py +0 -0
  73. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/example/survey.py +0 -0
  74. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/example/triangle_square.py +0 -0
  75. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/example/truss.py +0 -0
  76. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/in_out/__init__.py +0 -0
  77. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/in_out/parse_ace_lmap.py +0 -0
  78. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/in_out/parse_ace_nnf.py +0 -0
  79. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/in_out/parse_net.py +0 -0
  80. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/in_out/parser_utils.py +0 -0
  81. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/in_out/pgm_pickle.py +0 -0
  82. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/in_out/pgm_python.py +0 -0
  83. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/in_out/render_bugs.py +0 -0
  84. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/in_out/render_net.py +0 -0
  85. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/in_out/render_pomegranate.py +0 -0
  86. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/learning/__init__.py +0 -0
  87. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/learning/train_generative.py +0 -0
  88. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/pgm.py +0 -0
  89. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/pgm_circuit/__init__.py +0 -0
  90. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/pgm_circuit/marginals_program.py +0 -0
  91. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/pgm_circuit/mpe_program.py +0 -0
  92. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/pgm_circuit/pgm_circuit.py +0 -0
  93. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/pgm_circuit/program_with_slotmap.py +0 -0
  94. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/pgm_circuit/slot_map.py +0 -0
  95. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/pgm_circuit/support/__init__.py +0 -0
  96. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/pgm_circuit/support/compile_circuit.py +0 -0
  97. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/pgm_circuit/target_marginals_program.py +0 -0
  98. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/pgm_circuit/wmc_program.py +0 -0
  99. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/pgm_compiler/__init__.py +0 -0
  100. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/pgm_compiler/ace/__init__.py +0 -0
  101. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/pgm_compiler/ace/ace.py +0 -0
  102. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/pgm_compiler/factor_elimination.py +0 -0
  103. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/pgm_compiler/named_pgm_compilers.py +0 -0
  104. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/pgm_compiler/pgm_compiler.py +0 -0
  105. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/pgm_compiler/recursive_conditioning.py +0 -0
  106. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/pgm_compiler/support/__init__.py +0 -0
  107. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/pgm_compiler/support/circuit_table/__init__.py +0 -0
  108. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/pgm_compiler/support/circuit_table/_circuit_table_cy.c +0 -0
  109. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/pgm_compiler/support/circuit_table/_circuit_table_cy.pyx +0 -0
  110. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/pgm_compiler/support/circuit_table/_circuit_table_py.py +0 -0
  111. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/pgm_compiler/support/clusters.py +0 -0
  112. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/pgm_compiler/support/factor_tables.py +0 -0
  113. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/pgm_compiler/support/join_tree.py +0 -0
  114. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/pgm_compiler/support/named_compiler_maker.py +0 -0
  115. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/pgm_compiler/variable_elimination.py +0 -0
  116. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/probability/__init__.py +0 -0
  117. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/probability/empirical_probability_space.py +0 -0
  118. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/probability/pgm_probability_space.py +0 -0
  119. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/probability/probability_space.py +0 -0
  120. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/program/__init__.py +0 -0
  121. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/program/program.py +0 -0
  122. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/program/program_buffer.py +0 -0
  123. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/program/raw_program.py +0 -0
  124. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/sampling/__init__.py +0 -0
  125. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/sampling/forward_sampler.py +0 -0
  126. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/sampling/marginals_direct_sampler.py +0 -0
  127. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/sampling/sampler.py +0 -0
  128. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/sampling/sampler_support.py +0 -0
  129. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/sampling/uniform_sampler.py +0 -0
  130. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/sampling/wmc_direct_sampler.py +0 -0
  131. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/sampling/wmc_gibbs_sampler.py +0 -0
  132. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/sampling/wmc_metropolis_sampler.py +0 -0
  133. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/sampling/wmc_rejection_sampler.py +0 -0
  134. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/utils/__init__.py +0 -0
  135. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/utils/iter_extras.py +0 -0
  136. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/utils/local_config.py +0 -0
  137. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/utils/map_list.py +0 -0
  138. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/utils/map_set.py +0 -0
  139. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/utils/np_extras.py +0 -0
  140. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/utils/random_extras.py +0 -0
  141. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck/utils/tmp_dir.py +0 -0
  142. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck_demos/__init__.py +0 -0
  143. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck_demos/ace/__init__.py +0 -0
  144. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck_demos/ace/copy_ace_to_ck.py +0 -0
  145. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck_demos/ace/demo_ace.py +0 -0
  146. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck_demos/ace/simple_ace_demo.py +0 -0
  147. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck_demos/all_demos.py +0 -0
  148. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck_demos/circuit/__init__.py +0 -0
  149. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck_demos/circuit/demo_circuit_dump.py +0 -0
  150. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck_demos/circuit/demo_derivatives.py +0 -0
  151. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck_demos/circuit_compiler/__init__.py +0 -0
  152. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck_demos/circuit_compiler/compare_circuit_compilers.py +0 -0
  153. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck_demos/circuit_compiler/show_llvm_program.py +0 -0
  154. {compiled_knowledge-4.1.0a1/src/ck_demos/getting_started → compiled_knowledge-4.1.0a2/src/ck_demos/dataset}/__init__.py +0 -0
  155. {compiled_knowledge-4.1.0a1/src/ck_demos/pgm → compiled_knowledge-4.1.0a2/src/ck_demos/getting_started}/__init__.py +0 -0
  156. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck_demos/getting_started/simple_demo.py +0 -0
  157. {compiled_knowledge-4.1.0a1/src/ck_demos/pgm_compiler → compiled_knowledge-4.1.0a2/src/ck_demos/pgm}/__init__.py +0 -0
  158. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck_demos/pgm/demo_pgm_dump.py +0 -0
  159. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck_demos/pgm/demo_pgm_dump_stress.py +0 -0
  160. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck_demos/pgm/demo_pgm_string_rendering.py +0 -0
  161. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck_demos/pgm/show_examples.py +0 -0
  162. {compiled_knowledge-4.1.0a1/src/ck_demos/pgm_inference → compiled_knowledge-4.1.0a2/src/ck_demos/pgm_compiler}/__init__.py +0 -0
  163. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck_demos/pgm_compiler/compare_pgm_compilers.py +0 -0
  164. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck_demos/pgm_compiler/demo_compiler_dump.py +0 -0
  165. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck_demos/pgm_compiler/demo_factor_elimination.py +0 -0
  166. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck_demos/pgm_compiler/demo_join_tree.py +0 -0
  167. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck_demos/pgm_compiler/demo_marginals_program.py +0 -0
  168. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck_demos/pgm_compiler/demo_mpe_program.py +0 -0
  169. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck_demos/pgm_compiler/demo_pgm_compiler.py +0 -0
  170. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck_demos/pgm_compiler/demo_recursive_conditioning.py +0 -0
  171. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck_demos/pgm_compiler/demo_variable_elimination.py +0 -0
  172. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck_demos/pgm_compiler/demo_wmc_program.py +0 -0
  173. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck_demos/pgm_compiler/time_fe_compiler.py +0 -0
  174. {compiled_knowledge-4.1.0a1/src/ck_demos/programs → compiled_knowledge-4.1.0a2/src/ck_demos/pgm_inference}/__init__.py +0 -0
  175. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck_demos/pgm_inference/demo_inferencing_basic.py +0 -0
  176. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck_demos/pgm_inference/demo_inferencing_mpe_cancer.py +0 -0
  177. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck_demos/pgm_inference/demo_inferencing_wmc_and_mpe_sprinkler.py +0 -0
  178. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck_demos/pgm_inference/demo_inferencing_wmc_student.py +0 -0
  179. {compiled_knowledge-4.1.0a1/src/ck_demos/sampling → compiled_knowledge-4.1.0a2/src/ck_demos/programs}/__init__.py +0 -0
  180. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck_demos/programs/demo_program_buffer.py +0 -0
  181. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck_demos/programs/demo_program_multi.py +0 -0
  182. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck_demos/programs/demo_program_none.py +0 -0
  183. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck_demos/programs/demo_program_single.py +0 -0
  184. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck_demos/programs/demo_raw_program_dump.py +0 -0
  185. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck_demos/programs/demo_raw_program_interpreted.py +0 -0
  186. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck_demos/programs/demo_raw_program_llvm.py +0 -0
  187. {compiled_knowledge-4.1.0a1/src/ck_demos/utils → compiled_knowledge-4.1.0a2/src/ck_demos/sampling}/__init__.py +0 -0
  188. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck_demos/sampling/check_sampler.py +0 -0
  189. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck_demos/sampling/demo_marginal_direct_sampler.py +0 -0
  190. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck_demos/sampling/demo_uniform_sampler.py +0 -0
  191. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck_demos/sampling/demo_wmc_direct_sampler.py +0 -0
  192. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck_demos/utils/compare.py +0 -0
  193. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck_demos/utils/convert_network.py +0 -0
  194. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck_demos/utils/sample_model.py +0 -0
  195. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/ck_demos/utils/stop_watch.py +0 -0
  196. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/compiled_knowledge.egg-info/dependency_links.txt +0 -0
  197. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/compiled_knowledge.egg-info/requires.txt +0 -0
  198. {compiled_knowledge-4.1.0a1 → compiled_knowledge-4.1.0a2}/src/compiled_knowledge.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: compiled-knowledge
3
- Version: 4.1.0a1
3
+ Version: 4.1.0a2
4
4
  Summary: A Python package for compiling and querying discrete probabilistic graphical models.
5
5
  Author-email: Barry Drake <barry@compiledknowledge.org>
6
6
  License-Expression: MIT
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "compiled-knowledge"
3
- version = "4.1.0-a.1"
3
+ version = "4.1.0a2"
4
4
  description = "A Python package for compiling and querying discrete probabilistic graphical models."
5
5
  readme = "README.md"
6
6
  license = "MIT"
@@ -66,7 +66,7 @@ class CrossTable(MutableMapping[Instance, float]):
66
66
 
67
67
  def __setitem__(self, key: Instance, value) -> None:
68
68
  if value == 0:
69
- self._dict.pop(key, 0)
69
+ self._dict.pop(key)
70
70
  else:
71
71
  self._dict[key] = value
72
72
 
@@ -238,7 +238,7 @@ def cross_table_from_hard_dataset(
238
238
  weights: CrossTable = CrossTable(rvs, dirichlet_prior)
239
239
 
240
240
  columns: List[NDArray] = [
241
- dataset.states(rv)
241
+ dataset.state_idxs(rv)
242
242
  for rv in rvs
243
243
  ]
244
244
 
@@ -5,7 +5,7 @@ from typing import Sequence, Optional, Dict, Iterable, Tuple
5
5
  import numpy as np
6
6
 
7
7
  from ck.pgm import RandomVariable, State
8
- from ck.utils.np_extras import NDArray, DTypeStates, dtype_for_number_of_states
8
+ from ck.utils.np_extras import DTypeStates, dtype_for_number_of_states, NDArrayNumeric, NDArrayStates
9
9
 
10
10
 
11
11
  class Dataset:
@@ -17,7 +17,7 @@ class Dataset:
17
17
 
18
18
  def __init__(
19
19
  self,
20
- weights: Optional[NDArray | Sequence],
20
+ weights: Optional[NDArrayNumeric | Sequence],
21
21
  length: Optional[int],
22
22
  ):
23
23
  # Infer the length of the dataset.
@@ -30,14 +30,16 @@ class Dataset:
30
30
  self._rvs: Tuple[RandomVariable, ...] = ()
31
31
 
32
32
  # Set the weights array, and confirm its shape
33
- self._weights: NDArray
33
+ self._weights: NDArrayNumeric
34
34
  if weights is None:
35
35
  weights = np.ones(self._length)
36
36
  elif not isinstance(weights, np.ndarray):
37
- weights = np.array(weights)
37
+ weights = np.array(weights, dtype=np.float64)
38
38
  expected_shape = (self._length,)
39
39
  if weights.shape != expected_shape:
40
40
  raise ValueError(f'weights expected shape {expected_shape}, got {weights.shape}')
41
+ # if not isinstance(weights.dtype, NDArrayNumeric):
42
+ # raise ValueError(f'weights expected numeric dtype, got {weights.dtype}')
41
43
 
42
44
  self._weights = weights
43
45
 
@@ -55,7 +57,7 @@ class Dataset:
55
57
  return self._rvs
56
58
 
57
59
  @property
58
- def weights(self) -> NDArray:
60
+ def weights(self) -> NDArrayNumeric:
59
61
  """
60
62
  Get the instance weights.
61
63
  The notional weight of an instance is 1.
@@ -84,7 +86,7 @@ class Dataset:
84
86
  """
85
87
  rvs = self._rvs
86
88
  i: int = self._rvs.index(rv)
87
- self._rvs = rvs[:i] + rvs[i+1:]
89
+ self._rvs = rvs[:i] + rvs[i + 1:]
88
90
 
89
91
 
90
92
  class HardDataset(Dataset):
@@ -97,6 +99,7 @@ class HardDataset(Dataset):
97
99
  @staticmethod
98
100
  def from_soft_dataset(
99
101
  soft_dataset: SoftDataset,
102
+ *,
100
103
  adjust_instance_weights: bool = True,
101
104
  ) -> HardDataset:
102
105
  """
@@ -124,20 +127,24 @@ class HardDataset(Dataset):
124
127
 
125
128
  def __init__(
126
129
  self,
127
- data: Iterable[Tuple[RandomVariable, NDArray | Sequence[int]]] = (),
128
- weights: Optional[NDArray | Sequence] = None,
130
+ data: Iterable[Tuple[RandomVariable, NDArrayStates | Sequence[int]]] = (),
131
+ *,
132
+ weights: Optional[NDArrayNumeric | Sequence[float | int]] = None,
129
133
  length: Optional[int] = None,
130
134
  ):
131
135
  """
132
136
  Create a hard dataset.
133
137
 
138
+ When `weights` is a numpy array, then the dataset will directly reference the given array.
139
+ When `data` contains a numpy array, then the dataset will directly reference the given array.
140
+
134
141
  Args:
135
142
  data: optional iterable of (random variable, state idxs), passed
136
143
  to `self.add_rv_from_state_idxs`.
137
144
  weights: optional array of instance weights.
138
145
  length: optional length of the dataset, if omitted, the length is inferred.
139
146
  """
140
- self._data: Dict[RandomVariable, NDArray] = {}
147
+ self._data: Dict[RandomVariable, NDArrayStates] = {}
141
148
 
142
149
  # Initialise super by either weights, length or first data item.
143
150
  super_initialised: bool = False
@@ -154,9 +161,9 @@ class HardDataset(Dataset):
154
161
  if not super_initialised:
155
162
  super().__init__(weights, 0)
156
163
 
157
- def states(self, rv: RandomVariable) -> NDArray:
164
+ def state_idxs(self, rv: RandomVariable) -> NDArrayStates:
158
165
  """
159
- Get the state values (by state index) for one random variable.
166
+ Get the state indexes for one random variable.
160
167
  The index into the returned array is the instance index.
161
168
 
162
169
  Returns:
@@ -167,7 +174,7 @@ class HardDataset(Dataset):
167
174
  """
168
175
  return self._data[rv]
169
176
 
170
- def add_rv(self, rv: RandomVariable) -> NDArray:
177
+ def add_rv(self, rv: RandomVariable) -> NDArrayStates:
171
178
  """
172
179
  Add a random variable to the dataset, allocating and returning
173
180
  the state indices for the random variable.
@@ -198,11 +205,11 @@ class HardDataset(Dataset):
198
205
  del self._data[rv]
199
206
  self._remove_rv(rv)
200
207
 
201
- def add_rv_from_state_idxs(self, rv: RandomVariable, state_idxs: NDArray | Sequence[int]) -> NDArray:
208
+ def add_rv_from_state_idxs(self, rv: RandomVariable, state_idxs: NDArrayStates | Sequence[int]) -> NDArrayStates:
202
209
  """
203
210
  Add a random variable to the dataset.
204
211
 
205
- The dataset will directly reference the given `states` array.
212
+ When `state_idxs` is a numpy array, then the dataset will directly reference the given array.
206
213
 
207
214
  Args:
208
215
  rv: The random variable to add.
@@ -234,7 +241,7 @@ class HardDataset(Dataset):
234
241
  self._add_rv(rv)
235
242
  return rv_data
236
243
 
237
- def add_rv_from_states(self, rv: RandomVariable, states: Sequence[State]) -> NDArray:
244
+ def add_rv_from_states(self, rv: RandomVariable, states: Sequence[State]) -> NDArrayStates:
238
245
  """
239
246
  Add a random variable to the dataset.
240
247
 
@@ -266,9 +273,9 @@ class HardDataset(Dataset):
266
273
  def add_rv_from_state_weights(
267
274
  self,
268
275
  rv: RandomVariable,
269
- state_weights: NDArray,
276
+ state_weights: NDArrayNumeric,
270
277
  adjust_instance_weights: bool = True,
271
- ) -> NDArray:
278
+ ) -> NDArrayStates:
272
279
  """
273
280
  Add a random variable to the dataset.
274
281
 
@@ -306,7 +313,7 @@ class HardDataset(Dataset):
306
313
  )
307
314
 
308
315
  if adjust_instance_weights:
309
- row: NDArray
316
+ row: NDArrayNumeric
310
317
  for i, row in enumerate(state_weights):
311
318
  self._weights[i] *= row.sum()
312
319
 
@@ -320,13 +327,13 @@ class HardDataset(Dataset):
320
327
  Args:
321
328
  show_rvs: If `True`, the random variables are dumped.
322
329
  show_weights: If `True`, the instance weights are dumped.
323
- as_states: If `True`, the states are dumped Instead of just state indexes.
330
+ as_states: If `True`, the states are dumped instead of just state indexes.
324
331
  """
325
332
  if show_rvs:
326
333
  rvs = ', '.join(str(rv) for rv in self.rvs)
327
334
  print(f'rvs: [{rvs}]')
328
335
  print(f'instances ({len(self)}, with total weight {self.total_weight()}):')
329
- cols = [self.states(rv) for rv in self.rvs]
336
+ cols = [self.state_idxs(rv) for rv in self.rvs]
330
337
  for instance, weight in zip(zip(*cols), self.weights):
331
338
  if as_states:
332
339
  instance_str = ', '.join(repr(rv.states[idx]) for idx, rv in zip(instance, self.rvs))
@@ -367,25 +374,29 @@ class SoftDataset(Dataset):
367
374
  """
368
375
  dataset = SoftDataset(weights=hard_dataset.weights.copy())
369
376
  for rv in hard_dataset.rvs:
370
- dataset.add_rv_from_state_idxs(rv, hard_dataset.states(rv))
377
+ dataset.add_rv_from_state_idxs(rv, hard_dataset.state_idxs(rv))
371
378
  return dataset
372
379
 
373
380
  def __init__(
374
381
  self,
375
- data: Iterable[Tuple[RandomVariable, NDArray]] = (),
376
- weights: Optional[NDArray | Sequence] = None,
382
+ data: Iterable[Tuple[RandomVariable, NDArrayNumeric | Sequence[Sequence[float]]]] = (),
383
+ *,
384
+ weights: Optional[NDArrayNumeric | Sequence[float | int]] = None,
377
385
  length: Optional[int] = None,
378
386
  ):
379
387
  """
380
388
  Create a soft dataset.
381
389
 
390
+ When `weights` is a numpy array, then the dataset will directly reference the given array.
391
+ When `data` contains a numpy array, then the dataset will directly reference the given array.
392
+
382
393
  Args:
383
394
  data: optional iterable of (random variable, state weights), passed
384
395
  to `self.add_rv_from_state_weights`.
385
396
  weights: optional array of instance weights.
386
397
  length: optional length of the dataset, if omitted, the length is inferred.
387
398
  """
388
- self._data: Dict[RandomVariable, NDArray] = {}
399
+ self._data: Dict[RandomVariable, NDArrayNumeric] = {}
389
400
 
390
401
  # Initialise super by either weights, length or first data item.
391
402
  super_initialised: bool = False
@@ -423,10 +434,10 @@ class SoftDataset(Dataset):
423
434
  RuntimeError: if `check_negative_instance` is true and a negative
424
435
  instance weight is encountered.
425
436
  """
426
- state_weights: NDArray
437
+ state_weights: NDArrayNumeric
427
438
  i: int
428
439
 
429
- weights: NDArray = self.weights
440
+ weights: NDArrayNumeric = self.weights
430
441
  for i in range(self._length):
431
442
  for state_weights in self._data.values():
432
443
  weight_sum = state_weights[i].sum()
@@ -442,7 +453,7 @@ class SoftDataset(Dataset):
442
453
  elif check_negative_instance and instance_weight < 0:
443
454
  raise RuntimeError(f'negative instance weight: {i}')
444
455
 
445
- def state_weights(self, rv: RandomVariable) -> NDArray:
456
+ def state_weights(self, rv: RandomVariable) -> NDArrayNumeric:
446
457
  """
447
458
  Get the state weights for one random variable.
448
459
  The first index into the returned array is the instance index.
@@ -456,7 +467,7 @@ class SoftDataset(Dataset):
456
467
  """
457
468
  return self._data[rv]
458
469
 
459
- def add_rv(self, rv: RandomVariable) -> NDArray:
470
+ def add_rv(self, rv: RandomVariable) -> NDArrayNumeric:
460
471
  """
461
472
  Add a random variable to the dataset, allocating and returning
462
473
  the state indices for the random variable.
@@ -487,11 +498,15 @@ class SoftDataset(Dataset):
487
498
  del self._data[rv]
488
499
  self._remove_rv(rv)
489
500
 
490
- def add_rv_from_state_weights(self, rv: RandomVariable, state_weights: NDArray) -> NDArray:
501
+ def add_rv_from_state_weights(
502
+ self,
503
+ rv: RandomVariable,
504
+ state_weights: NDArrayNumeric | Sequence[Sequence[float]],
505
+ ) -> NDArrayNumeric:
491
506
  """
492
507
  Add a random variable to the dataset.
493
508
 
494
- The dataset will directly reference the given `states` array.
509
+ When `state_weights` is a numpy array, then the dataset will directly reference the given array.
495
510
 
496
511
  Args:
497
512
  rv: The random variable to add.
@@ -503,6 +518,9 @@ class SoftDataset(Dataset):
503
518
  if rv in self._data.keys():
504
519
  raise ValueError(f'data for {rv} already exists in the dataset')
505
520
 
521
+ if not isinstance(state_weights, np.ndarray):
522
+ state_weights = np.array(state_weights, dtype=np.float64)
523
+
506
524
  expected_shape = (self._length, len(rv))
507
525
  if state_weights.shape == expected_shape:
508
526
  rv_data = state_weights
@@ -513,7 +531,7 @@ class SoftDataset(Dataset):
513
531
  self._add_rv(rv)
514
532
  return rv_data
515
533
 
516
- def add_rv_from_state_idxs(self, rv: RandomVariable, state_idxs: NDArray | Sequence[int]) -> NDArray:
534
+ def add_rv_from_state_idxs(self, rv: RandomVariable, state_idxs: NDArrayStates | Sequence[int]) -> NDArrayNumeric:
517
535
  """
518
536
  Add a random variable to the dataset.
519
537
 
@@ -533,7 +551,7 @@ class SoftDataset(Dataset):
533
551
 
534
552
  return self.add_rv_from_state_weights(rv, rv_data)
535
553
 
536
- def add_rv_from_states(self, rv: RandomVariable, states: Sequence[State]) -> NDArray:
554
+ def add_rv_from_states(self, rv: RandomVariable, states: Sequence[State]) -> NDArrayNumeric:
537
555
  """
538
556
  Add a random variable to the dataset.
539
557
 
@@ -558,7 +576,6 @@ class SoftDataset(Dataset):
558
576
  def dump(self, *, show_rvs: bool = True, show_weights: bool = True) -> None:
559
577
  """
560
578
  Dump the dataset in a human-readable format.
561
- If as_states is true, then instance states are dumped instead of just state indexes.
562
579
 
563
580
  Args:
564
581
  show_rvs: If `True`, the random variables are dumped.