compiled-knowledge 4.0.0a11__cp312-cp312-win_amd64.whl → 4.0.0a15__cp312-cp312-win_amd64.whl

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.

@@ -18,19 +18,19 @@ class NamedCircuitCompiler(Enum):
18
18
  Each member itself is callable, conforming to the CircuitCompiler protocol, delegating to the compiler function.
19
19
  """
20
20
 
21
- LLVM_STACK: CircuitCompiler = (partial(llvm_compiler.compile_circuit, flavour=Flavour.STACK),)
22
- LLVM_TMPS: CircuitCompiler = (partial(llvm_compiler.compile_circuit, flavour=Flavour.TMPS, opt=0),)
23
- LLVM_VM: CircuitCompiler = (llvm_vm_compiler.compile_circuit,)
24
- CYTHON_VM: CircuitCompiler = (cython_vm_compiler.compile_circuit,)
25
- INTERPRET: CircuitCompiler = (interpret_compiler.compile_circuit,)
21
+ LLVM_STACK = (partial(llvm_compiler.compile_circuit, flavour=Flavour.STACK),)
22
+ LLVM_TMPS = (partial(llvm_compiler.compile_circuit, flavour=Flavour.TMPS, opt=0),)
23
+ LLVM_VM = (llvm_vm_compiler.compile_circuit,)
24
+ CYTHON_VM = (cython_vm_compiler.compile_circuit,)
25
+ INTERPRET = (interpret_compiler.compile_circuit,)
26
26
 
27
- # The following circuit compilers were experimental but are not really useful
27
+ # The following circuit compilers were experimental but are not really useful.
28
28
  #
29
29
  # Slow compile and execution:
30
- # LLVM_FUNCS: CircuitCompiler = (partial(llvm_compiler.compile_circuit, flavour=Flavour.FUNCS, opt=0),)
30
+ # LLVM_FUNCS = (partial(llvm_compiler.compile_circuit, flavour=Flavour.FUNCS, opt=0),)
31
31
  #
32
32
  # Slow compile and same execution as LLVM_VM:
33
- # LLVM_VM_COMPILED_ARRAYS: CircuitCompiler = (partial(llvm_vm_compiler.compile_circuit, compile_arrays=True),)
33
+ # LLVM_VM_COMPILED_ARRAYS = (partial(llvm_vm_compiler.compile_circuit, compile_arrays=True),)
34
34
 
35
35
  def __call__(
36
36
  self,
ck/example/pathfinder.py CHANGED
@@ -2,25 +2,33 @@ from ck.pgm import PGM
2
2
 
3
3
 
4
4
  class Pathfinder(PGM):
5
+ """
6
+ This implementation of the Pathfinder PGM has 93 states for the "Fault" random
7
+ variable, and its factor has been normalised to be a CPT.
8
+ """
5
9
 
6
10
  def __init__(self):
7
11
  super().__init__(self.__class__.__name__)
8
12
 
9
13
  pgm_rv0 = self.new_rv('Fault', (
10
- 'AIDS early', 'AILD', 'ALIP', 'Cat scratch disease', 'Dermatopathic laden', 'Florid follic hyperp',
11
- 'GLH hyaline vascular', 'GLH plasma cell', 'Granulomatous laden', 'Histiocytosis x', 'Infectious mono',
12
- 'Leprosy-lepromatous', 'Lymphangiographic', 'Mantle zone hyperpla', 'Necrotizing Kikuchi',
13
- 'Necrotiz non-Kikuchi', 'Rheumatoid arthritis', 'Sarcoidosis', 'SHML', 'Sinus histiocytosis', 'Syphilis',
14
- 'Toxoplasmosis', 'Tuberculosis', 'Viral NOS', "Whipple's disease", 'L&H nodular HD', 'L&H diffuse HD',
15
- 'Nodular sclerosis HD', 'Cellular phase NSHD', 'Syncytial NSHD', 'Mixed cellularity HD', 'Interfollicular HD',
16
- 'Diffuse fibrosis HD', 'Reticular-type HD', 'Small cleaved fol', 'Mixed fol', 'Large cell fol',
17
- 'Small noncleaved fol', 'Small lymphocytic', 'Plasmacytoid lyctic', 'Mantle zone lymphoma', 'Small cleaved dif',
18
- 'Mixed FCC dif', 'Large cell dif', 'B-immunoblastic', 'T-immunob mixed', 'AILD-like T-cell lym', 'Japanese ATL',
19
- 'Lymphoblastic', 'Small noncleaved dif', 'True histiocytic', 'Ki-1 LC anaplas T', 'Multiple myeloma',
20
- 'Mycosis fungoides', 'AML', 'Hairy cell leukemia', 'Carcinoma', 'Melanoma', 'EM plasmacytoma',
21
- "Kaposi's sarcoma", 'Mast-cell disease', 'AIDS involutionary', 'T-immunob large', 'Monocytoid B-cell',
22
- 'Nasopharyngeal CA', 'Seminoma', 'SLE', 'Mycobact histiocytos', 'Mast-cell hyperplas', 'LGV', 'Histoplasmosis',
23
- 'Coccidioidomycosis', 'CMV', 'Brucellosis', 'Ki-1 LC anaplas B', 'Intermed lymphocytic'))
14
+ 'AIDS early', 'AILD', 'ALIP', 'Cat scratch disease', 'Dermatopathic laden', 'Florid follic hyperp',
15
+ 'GLH hyaline vascular', 'GLH plasma cell', 'Granulomatous laden', 'Histiocytosis x', 'Infectious mono',
16
+ 'Leprosy-lepromatous', 'Lymphangiographic', 'Mantle zone hyperpla', 'Necrotizing Kikuchi',
17
+ 'Necrotiz non-Kikuchi', 'Rheumatoid arthritis', 'Sarcoidosis', 'SHML', 'Sinus histiocytosis', 'Syphilis',
18
+ 'Toxoplasmosis', 'Tuberculosis', 'Viral NOS', "Whipple's disease", 'L&H nodular HD', 'L&H diffuse HD',
19
+ 'Nodular sclerosis HD', 'Cellular phase NSHD', 'Syncytial NSHD', 'Mixed cellularity HD',
20
+ 'Interfollicular HD',
21
+ 'Diffuse fibrosis HD', 'Reticular-type HD', 'Small cleaved fol', 'Mixed fol', 'Large cell fol',
22
+ 'Small noncleaved fol', 'Small lymphocytic', 'Plasmacytoid lyctic', 'Mantle zone lymphoma',
23
+ 'Small cleaved dif',
24
+ 'Mixed FCC dif', 'Large cell dif', 'B-immunoblastic', 'T-immunob mixed', 'AILD-like T-cell lym',
25
+ 'Japanese ATL',
26
+ 'Lymphoblastic', 'Small noncleaved dif', 'True histiocytic', 'Ki-1 LC anaplas T', 'Multiple myeloma',
27
+ 'Mycosis fungoides', 'AML', 'Hairy cell leukemia', 'Carcinoma', 'Melanoma', 'EM plasmacytoma',
28
+ "Kaposi's sarcoma", 'Mast-cell disease', 'AIDS involutionary', 'T-immunob large', 'Monocytoid B-cell',
29
+ 'Nasopharyngeal CA', 'Seminoma', 'SLE', 'Mycobact histiocytos', 'Mast-cell hyperplas', 'LGV',
30
+ 'Histoplasmosis',
31
+ 'Coccidioidomycosis', 'CMV', 'Brucellosis', 'Ki-1 LC anaplas B', 'Intermed lymphocytic'))
24
32
  pgm_rv1 = self.new_rv('ACID', ('Negative', 'Positive'))
25
33
  pgm_rv2 = self.new_rv('F_CSA', ('No follicles', 'Absent', 'Present'))
26
34
  pgm_rv3 = self.new_rv('F_ISL', ('No follicles', 'Absent', 'Present'))
@@ -58,25 +66,27 @@ class Pathfinder(PGM):
58
66
  ('Absent [0]', 'Rare [1-5]', 'Few [6-25]', 'Many [26-100]', 'Striking [>100]'))
59
67
  pgm_rv34 = self.new_rv('LH_NOD', ('Absent', 'Present'))
60
68
  pgm_rv35 = self.new_rv('LACUN', (
61
- 'Absent [0]', 'Rare [1-5]', 'Few [6-25]', 'Many [26 - 100]', 'Striking [>100]', 'Sheets [>50pc of section]'))
69
+ 'Absent [0]', 'Rare [1-5]', 'Few [6-25]', 'Many [26 - 100]', 'Striking [>100]',
70
+ 'Sheets [>50pc of section]'))
62
71
  pgm_rv36 = self.new_rv('LANG', ('Absent [0]', 'Present [1-5]', 'Prominent [>5]'))
63
72
  pgm_rv37 = self.new_rv('LEUK', ('Absent', 'Present'))
64
73
  pgm_rv38 = self.new_rv('LLC_CY', ('No LLCs', 'Scanty', 'Moderate-abundant clear', 'Moderate-abundant deep'))
65
74
  pgm_rv39 = self.new_rv('LLC_NS', (
66
- 'No LLCs', 'Multilobated [some]', 'Cerebriform/Mulberry [some]', 'Convoluted [some]', 'Irregular [most]',
67
- 'Round/slightly irregular [most]'))
75
+ 'No LLCs', 'Multilobated [some]', 'Cerebriform/Mulberry [some]', 'Convoluted [some]', 'Irregular [most]',
76
+ 'Round/slightly irregular [most]'))
68
77
  pgm_rv40 = self.new_rv('LLC', (
69
- 'Absent [0pc]', 'Sparse [<10pc]', 'Moderate [11-50pc]', 'Numerous [51-90pc]', 'Striking [>90pc]'))
78
+ 'Absent [0pc]', 'Sparse [<10pc]', 'Moderate [11-50pc]', 'Numerous [51-90pc]', 'Striking [>90pc]'))
70
79
  pgm_rv41 = self.new_rv('F_POPU', (
71
- 'No follicles', '>80pc 6-12u', '>50pc 13-20u with nucleoli', '>50pc >20u with nucleoli', 'Other'))
80
+ 'No follicles', '>80pc 6-12u', '>50pc 13-20u with nucleoli', '>50pc >20u with nucleoli', 'Other'))
72
81
  pgm_rv42 = self.new_rv('MAST', ('Absent [0]', 'Present [1-50]', 'Prominent [>50]'))
73
82
  pgm_rv43 = self.new_rv('MLC', (
74
- 'Absent [0pc]', 'Sparse [<10pc]', 'Moderate [11-50pc]', 'Numerous [51-90pc]', 'Striking [>90pc]'))
83
+ 'Absent [0pc]', 'Sparse [<10pc]', 'Moderate [11-50pc]', 'Numerous [51-90pc]', 'Striking [>90pc]'))
75
84
  pgm_rv44 = self.new_rv('MELANOMA', ('Absent', 'Present'))
76
85
  pgm_rv45 = self.new_rv('MF10HP', ('0-5', '6-15', '16-50', '>50'))
77
86
  pgm_rv46 = self.new_rv('MLC_CY', ('No MLCs', 'Scanty', 'Moderate-abundant clear', 'Moderate-abundant deep'))
78
87
  pgm_rv47 = self.new_rv('MLC_NS', (
79
- 'No MLCs', 'Cerebriform [some]', 'Convoluted [some]', 'Irregular [most]', 'Round/slightly irregular [most]'))
88
+ 'No MLCs', 'Cerebriform [some]', 'Convoluted [some]', 'Irregular [most]',
89
+ 'Round/slightly irregular [most]'))
80
90
  pgm_rv48 = self.new_rv('MLC_NI', ('No MLCs', 'Absent to rare', 'Large central', 'Peripheral', 'Other'))
81
91
  pgm_rv49 = self.new_rv('MCC', ('Absent [0pc]', 'Present [<5pc]', 'Prominent [5-50pc]', 'Confluence [>50pc]'))
82
92
  pgm_rv50 = self.new_rv('MONO', ('Absent [0]', 'Rare [1-2]', 'Present [3-20]', 'Many [>20]'))
@@ -90,7 +100,8 @@ class Pathfinder(PGM):
90
100
  pgm_rv57 = self.new_rv('PAS', ('No', 'Yes'))
91
101
  pgm_rv58 = self.new_rv('PI', ('Absent', 'Present', 'Prominent'))
92
102
  pgm_rv59 = self.new_rv('PLASMA', (
93
- 'Absent [0pc]', 'Few [<5pc]', 'Moderate [6-20pc]', 'Marked [21-50pc]', 'Striking [51-90pc]', 'Sheets [>90pc]'))
103
+ 'Absent [0pc]', 'Few [<5pc]', 'Moderate [6-20pc]', 'Marked [21-50pc]', 'Striking [51-90pc]',
104
+ 'Sheets [>90pc]'))
94
105
  pgm_rv60 = self.new_rv('PC_TP', ('No plasma cells', 'Mature', 'Immature', 'Blastic', 'Pleomorphic', 'Mixed'))
95
106
  pgm_rv61 = self.new_rv('PLEO', ('Absent [0]', 'Rare [1-5]', 'Few [6-25]', 'Many [26-100]', 'Striking [>100]'))
96
107
  pgm_rv62 = self.new_rv('PFP', ('Absent', 'Present'))
@@ -101,10 +112,10 @@ class Pathfinder(PGM):
101
112
  pgm_rv67 = self.new_rv('S_RING', ('Absent', 'Present'))
102
113
  pgm_rv68 = self.new_rv('SLC_CY', ('No SLCs', 'Scanty', 'Moderate-abundant clear', 'Moderate-abundant deep'))
103
114
  pgm_rv69 = self.new_rv('SLC_NS', (
104
- 'No SLCs', 'Cerebriform [some]', 'Convoluted [some]', 'Moderate-mark irregular [most]',
105
- 'Round/slightly irregular [most]'))
115
+ 'No SLCs', 'Cerebriform [some]', 'Convoluted [some]', 'Moderate-mark irregular [most]',
116
+ 'Round/slightly irregular [most]'))
106
117
  pgm_rv70 = self.new_rv('SLC', (
107
- 'Absent [0pc]', 'Sparse [1-10pc]', 'Moderate [11-50pc]', 'Numerous [51-90pc]', 'Striking [>90pc]'))
118
+ 'Absent [0pc]', 'Sparse [1-10pc]', 'Moderate [11-50pc]', 'Numerous [51-90pc]', 'Striking [>90pc]'))
108
119
  pgm_rv71 = self.new_rv('SINUSES', ('Distended', 'Patent', 'Part-greatly obliterated', 'Completely obliterated'))
109
120
  pgm_rv72 = self.new_rv('VASC_C', ('Absent', 'Present'))
110
121
  pgm_rv73 = self.new_rv('VASC_NS', ('Absent', 'Slight', 'Moderate', 'Marked', 'Pronounced'))
@@ -123,11 +134,12 @@ class Pathfinder(PGM):
123
134
  pgm_rv86 = self.new_rv('F_SS',
124
135
  ('No follicles', 'Absent [0]', 'Slight [1-15]', 'Moderate [16-30]', 'Marked [>30]'))
125
136
  pgm_rv87 = self.new_rv('F_MZSTAT', (
126
- 'No follicles/no mantle zones', 'Mantle zones absent in most follicles', 'Most incompletely surround follicles',
127
- 'Most completely surround fol not thick', 'Most thick [>10 lymphocytes]'))
137
+ 'No follicles/no mantle zones', 'Mantle zones absent in most follicles',
138
+ 'Most incompletely surround follicles',
139
+ 'Most completely surround fol not thick', 'Most thick [>10 lymphocytes]'))
128
140
  pgm_rv88 = self.new_rv('F_MZCM', ('No follicles/no mantle zones', 'Absent', 'Present'))
129
141
  pgm_rv89 = self.new_rv('F_DEF', (
130
- 'No follicles', 'Almost all well defined', 'Both well and poor defined', 'Almost all poor defined'))
142
+ 'No follicles', 'Almost all well defined', 'Both well and poor defined', 'Almost all poor defined'))
131
143
  pgm_rv90 = self.new_rv('F_MITO', ('No follicles', '0-20', '21-50', '>50'))
132
144
  pgm_rv91 = self.new_rv('F_MZ', ('No follicles', 'Absent', 'Present'))
133
145
  pgm_rv92 = self.new_rv('F_CIO', ('No follicles', 'Most similar', 'Some similar', 'None similar'))
@@ -169,13 +181,14 @@ class Pathfinder(PGM):
169
181
  pgm_rv128 = self.new_rv('TB', ('Absent', 'Present', 'Prominent'))
170
182
  pgm_rv129 = self.new_rv('MELANIN', ('Absent to normal', 'Present', 'Prominent'))
171
183
  pgm_rv130 = self.new_rv('MC_SL_NS', (
172
- 'No follicles/no mantle zones', 'Round', 'Slightly irregular', 'Moderately irregular', 'Markedly irregular'))
184
+ 'No follicles/no mantle zones', 'Round', 'Slightly irregular', 'Moderately irregular',
185
+ 'Markedly irregular'))
173
186
  pgm_rv131 = self.new_rv('FMZ_FUS', (
174
- 'No thick mantle zones', 'No nodules no fusion', 'Nodules but no fusion', 'Fusion with or without nodules'))
187
+ 'No thick mantle zones', 'No nodules no fusion', 'Nodules but no fusion', 'Fusion with or without nodules'))
175
188
  pgm_rv132 = self.new_rv('BH_NOS_L', ('No NOS benign histiocytes', 'Mainly interfollicular', 'Mainly sinusoidal',
176
189
  'Both interfollicular and sinusoidal'))
177
190
  pgm_rv133 = self.new_rv('SLC_NI', (
178
- 'No SLCs', 'None identifiable', '1 or more peripheral small', '1 central medium to large', 'Other'))
191
+ 'No SLCs', 'None identifiable', '1 or more peripheral small', '1 central medium to large', 'Other'))
179
192
  pgm_rv134 = self.new_rv('HYALIN', ('Absent', 'Present', 'Prominent'))
180
193
  pgm_factor0 = self.new_factor(pgm_rv0)
181
194
  pgm_factor1 = self.new_factor(pgm_rv1, pgm_rv128)
@@ -315,22 +328,82 @@ class Pathfinder(PGM):
315
328
 
316
329
  pgm_function0 = pgm_factor0.set_dense()
317
330
  pgm_function0.set_flat(
318
- 20.0, 1.5, 5.0, 5.0, 25.0,
319
- 25.0, 5.0, 5.0, 15.0, 4.0,
320
- 2.0, 2.0, 5.0, 12.5, 8.0,
321
- 12.8, 2.0, 2.0, 3.0, 20.0,
322
- 2.0, 5.0, 4.0, 15.0, 0.5,
323
- 15.0, 2.5, 90.0, 8.0, 8.0,
324
- 70.0, 5.0, 3.0, 3.0, 110.0,
325
- 55.0, 20.0, 5.0, 40.0, 8.0,
326
- 10.0, 5.0, 6.0, 110.0, 20.0,
327
- 20.0, 12.0, 2.0, 10.0, 80.0,
328
- 1.0, 15.0, 2.0, 3.0, 5.0,
329
- 0.1, 20.0, 8.0, 5.0, 8.0,
330
- 2.0, 20.0, 25.0, 20.0, 5.0,
331
- 2.0, 2.0, 2.0, 2.0, 2.0,
332
- 2.0, 2.0, 5.0, 0.25, 4.0,
333
- 8.0
331
+ 0.018279029,
332
+ 0.001370927,
333
+ 0.004569757,
334
+ 0.004569757,
335
+ 0.022848787,
336
+ 0.022848787,
337
+ 0.004569757,
338
+ 0.004569757,
339
+ 0.013709272,
340
+ 0.003655806,
341
+ 0.001827903,
342
+ 0.001827903,
343
+ 0.004569757,
344
+ 0.011424393,
345
+ 0.007311612,
346
+ 0.011698579,
347
+ 0.001827903,
348
+ 0.001827903,
349
+ 0.002741854,
350
+ 0.018279029,
351
+ 0.001827903,
352
+ 0.004569757,
353
+ 0.003655806,
354
+ 0.013709272,
355
+ 0.000456976,
356
+ 0.013709272,
357
+ 0.002284879,
358
+ 0.082255632,
359
+ 0.007311612,
360
+ 0.007311612,
361
+ 0.063976603,
362
+ 0.004569757,
363
+ 0.002741854,
364
+ 0.002741854,
365
+ 0.100534662,
366
+ 0.050267331,
367
+ 0.018279029,
368
+ 0.004569757,
369
+ 0.036558059,
370
+ 0.007311612,
371
+ 0.009139515,
372
+ 0.004569757,
373
+ 0.005483709,
374
+ 0.100534662,
375
+ 0.018279029,
376
+ 0.018279029,
377
+ 0.010967418,
378
+ 0.001827903,
379
+ 0.009139515,
380
+ 0.073116118,
381
+ 0.000913951,
382
+ 0.013709272,
383
+ 0.001827903,
384
+ 0.002741854,
385
+ 0.004569757,
386
+ 9.13951E-05,
387
+ 0.018279029,
388
+ 0.007311612,
389
+ 0.004569757,
390
+ 0.007311612,
391
+ 0.001827903,
392
+ 0.018279029,
393
+ 0.022848787,
394
+ 0.018279029,
395
+ 0.004569757,
396
+ 0.001827903,
397
+ 0.001827903,
398
+ 0.001827903,
399
+ 0.001827903,
400
+ 0.001827903,
401
+ 0.001827903,
402
+ 0.001827903,
403
+ 0.004569757,
404
+ 0.000228488,
405
+ 0.003655806,
406
+ 0.007311612,
334
407
  )
335
408
 
336
409
  pgm_function1 = pgm_factor1.set_dense()
@@ -108,7 +108,7 @@ class Parser(ABC):
108
108
  except ParseError as e:
109
109
  raise e
110
110
  except Exception as e:
111
- input_stream.raise_error(e)
111
+ input_stream.raise_error(str(e))
112
112
 
113
113
  @abstractmethod
114
114
  def comment(self, raise_f, message: str) -> None:
@@ -64,10 +64,20 @@ def read_nnf_with_literal_map(
64
64
  check_header=check_header,
65
65
  optimise_ops=optimise_ops,
66
66
  )
67
+ circuit = top_node.circuit
68
+
69
+ # Build the slot map from indicator to slot.
70
+ # Some indicators may not be in `literal_slot_map` because they were not needed
71
+ # for the arithmetic circuit in the NNF file. For those indicators, we create
72
+ # dummy circuit vars.
73
+ def _get_slot(_literal_code: int) -> int:
74
+ _slot: Optional[int] = literal_slot_map.get(_literal_code)
75
+ if _slot is None:
76
+ _slot: int = circuit.new_var().idx
77
+ return _slot
67
78
 
68
- # Build the slot map from indicator to slot
69
79
  slot_map: Dict[SlotKey, int] = {
70
- indicator: literal_slot_map[literal_code]
80
+ indicator: _get_slot(literal_code)
71
81
  for literal_code, indicator in literal_map.indicators.items()
72
82
  }
73
83
 
@@ -193,7 +203,7 @@ class Parser(ABC):
193
203
  except ParseError as e:
194
204
  raise e
195
205
  except Exception as e:
196
- input_stream.raise_error(e)
206
+ input_stream.raise_error(str(e))
197
207
 
198
208
  @abstractmethod
199
209
  def comment(self, raise_f, message: str) -> None:
@@ -101,16 +101,13 @@ def compile_pgm(
101
101
  node_names: List[str] = render_bayesian_network(pgm, file, check_structure_bayesian=False)
102
102
 
103
103
  # Run Ace
104
- ace_result: subprocess.CompletedProcess = subprocess.run(ace_cmd, capture_output=True, text=True)
105
- if print_output:
106
- print(ace_result.stdout)
107
- print(ace_result.stderr)
104
+ ace_result: subprocess.CompletedProcess = subprocess.run(ace_cmd, capture_output=(not print_output), text=True)
108
105
  if ace_result.returncode != 0:
109
106
  raise subprocess.CalledProcessError(
110
107
  returncode=ace_result.returncode,
111
108
  cmd=' '.join(ace_cmd),
112
- output=ace_result.stdout,
113
- stderr=ace_result.stderr,
109
+ output=None if print_output else ace_result.stdout,
110
+ stderr=None if print_output else ace_result.stderr,
114
111
  )
115
112
 
116
113
  # Parse the literal map output from Ace
@@ -21,7 +21,7 @@ def compile_pgm(
21
21
  *,
22
22
  algorithm: JoinTreeAlgorithm = MIN_FILL_THEN_DEGREE,
23
23
  limit_product_tree_search: int = DEFAULT_PRODUCT_SEARCH_LIMIT,
24
- pre_prune_factor_tables: bool = True,
24
+ pre_prune_factor_tables: bool = False,
25
25
  ) -> PGMCircuit:
26
26
  """
27
27
  Compile the PGM to an arithmetic circuit, using factor elimination.
@@ -60,7 +60,7 @@ def compile_pgm_best_jointree(
60
60
  const_parameters: bool = True,
61
61
  *,
62
62
  limit_product_tree_search: int = DEFAULT_PRODUCT_SEARCH_LIMIT,
63
- pre_prune_factor_tables: bool = True,
63
+ pre_prune_factor_tables: bool = False,
64
64
  ) -> PGMCircuit:
65
65
  """
66
66
  Try multiple elimination heuristics, and use the join tree that has
@@ -114,7 +114,7 @@ def join_tree_to_circuit(
114
114
  join_tree: JoinTree,
115
115
  const_parameters: bool = True,
116
116
  limit_product_tree_search: int = DEFAULT_PRODUCT_SEARCH_LIMIT,
117
- pre_prune_factor_tables: bool = True,
117
+ pre_prune_factor_tables: bool = False,
118
118
  ) -> PGMCircuit:
119
119
  """
120
120
  Construct a PGMCircuit from a join-tree.
@@ -18,32 +18,32 @@ class NamedPGMCompiler(Enum):
18
18
  """
19
19
  # @formatter:off
20
20
 
21
- VE_MIN_DEGREE: PGMCompiler = _get_compiler_algorithm(variable_elimination, 'MIN_DEGREE')
22
- VE_MIN_DEGREE_THEN_FILL: PGMCompiler = _get_compiler_algorithm(variable_elimination, 'MIN_DEGREE_THEN_FILL')
23
- VE_MIN_FILL: PGMCompiler = _get_compiler_algorithm(variable_elimination, 'MIN_FILL')
24
- VE_MIN_FILL_THEN_DEGREE: PGMCompiler = _get_compiler_algorithm(variable_elimination, 'MIN_FILL_THEN_DEGREE')
25
- VE_MIN_WEIGHTED_DEGREE: PGMCompiler = _get_compiler_algorithm(variable_elimination, 'MIN_WEIGHTED_DEGREE')
26
- VE_MIN_WEIGHTED_FILL: PGMCompiler = _get_compiler_algorithm(variable_elimination, 'MIN_WEIGHTED_FILL')
27
- VE_MIN_TRADITIONAL_WEIGHTED_FILL: PGMCompiler = _get_compiler_algorithm(variable_elimination, 'MIN_TRADITIONAL_WEIGHTED_FILL')
28
-
29
- FE_MIN_DEGREE: PGMCompiler = _get_compiler_algorithm(factor_elimination, 'MIN_DEGREE')
30
- FE_MIN_DEGREE_THEN_FILL: PGMCompiler = _get_compiler_algorithm(factor_elimination, 'MIN_DEGREE_THEN_FILL')
31
- FE_MIN_FILL: PGMCompiler = _get_compiler_algorithm(factor_elimination, 'MIN_FILL')
32
- FE_MIN_FILL_THEN_DEGREE: PGMCompiler = _get_compiler_algorithm(factor_elimination, 'MIN_FILL_THEN_DEGREE')
33
- FE_MIN_WEIGHTED_DEGREE: PGMCompiler = _get_compiler_algorithm(factor_elimination, 'MIN_WEIGHTED_DEGREE')
34
- FE_MIN_WEIGHTED_FILL: PGMCompiler = _get_compiler_algorithm(factor_elimination, 'MIN_WEIGHTED_FILL')
35
- FE_MIN_TRADITIONAL_WEIGHTED_FILL: PGMCompiler = _get_compiler_algorithm(factor_elimination, 'MIN_TRADITIONAL_WEIGHTED_FILL')
36
- FE_BEST_JOINTREE: PGMCompiler = factor_elimination.compile_pgm_best_jointree,
37
-
38
- RC_MIN_DEGREE: PGMCompiler = _get_compiler_algorithm(recursive_conditioning, 'MIN_DEGREE')
39
- RC_MIN_DEGREE_THEN_FILL: PGMCompiler = _get_compiler_algorithm(recursive_conditioning, 'MIN_DEGREE_THEN_FILL')
40
- RC_MIN_FILL: PGMCompiler = _get_compiler_algorithm(recursive_conditioning, 'MIN_FILL')
41
- RC_MIN_FILL_THEN_DEGREE: PGMCompiler = _get_compiler_algorithm(recursive_conditioning, 'MIN_FILL_THEN_DEGREE')
42
- RC_MIN_WEIGHTED_DEGREE: PGMCompiler = _get_compiler_algorithm(recursive_conditioning, 'MIN_WEIGHTED_DEGREE')
43
- RC_MIN_WEIGHTED_FILL: PGMCompiler = _get_compiler_algorithm(recursive_conditioning, 'MIN_WEIGHTED_FILL')
44
- RC_MIN_TRADITIONAL_WEIGHTED_FILL: PGMCompiler = _get_compiler_algorithm(recursive_conditioning, 'MIN_TRADITIONAL_WEIGHTED_FILL')
45
-
46
- ACE: PGMCompiler = _get_compiler(ace)
21
+ VE_MIN_DEGREE = _get_compiler_algorithm(variable_elimination, 'MIN_DEGREE')
22
+ VE_MIN_DEGREE_THEN_FILL = _get_compiler_algorithm(variable_elimination, 'MIN_DEGREE_THEN_FILL')
23
+ VE_MIN_FILL = _get_compiler_algorithm(variable_elimination, 'MIN_FILL')
24
+ VE_MIN_FILL_THEN_DEGREE = _get_compiler_algorithm(variable_elimination, 'MIN_FILL_THEN_DEGREE')
25
+ VE_MIN_WEIGHTED_DEGREE = _get_compiler_algorithm(variable_elimination, 'MIN_WEIGHTED_DEGREE')
26
+ VE_MIN_WEIGHTED_FILL = _get_compiler_algorithm(variable_elimination, 'MIN_WEIGHTED_FILL')
27
+ VE_MIN_TRADITIONAL_WEIGHTED_FILL = _get_compiler_algorithm(variable_elimination, 'MIN_TRADITIONAL_WEIGHTED_FILL')
28
+
29
+ FE_MIN_DEGREE = _get_compiler_algorithm(factor_elimination, 'MIN_DEGREE')
30
+ FE_MIN_DEGREE_THEN_FILL = _get_compiler_algorithm(factor_elimination, 'MIN_DEGREE_THEN_FILL')
31
+ FE_MIN_FILL = _get_compiler_algorithm(factor_elimination, 'MIN_FILL')
32
+ FE_MIN_FILL_THEN_DEGREE = _get_compiler_algorithm(factor_elimination, 'MIN_FILL_THEN_DEGREE')
33
+ FE_MIN_WEIGHTED_DEGREE = _get_compiler_algorithm(factor_elimination, 'MIN_WEIGHTED_DEGREE')
34
+ FE_MIN_WEIGHTED_FILL = _get_compiler_algorithm(factor_elimination, 'MIN_WEIGHTED_FILL')
35
+ FE_MIN_TRADITIONAL_WEIGHTED_FILL = _get_compiler_algorithm(factor_elimination, 'MIN_TRADITIONAL_WEIGHTED_FILL')
36
+ FE_BEST_JOINTREE = factor_elimination.compile_pgm_best_jointree,
37
+
38
+ RC_MIN_DEGREE = _get_compiler_algorithm(recursive_conditioning, 'MIN_DEGREE')
39
+ RC_MIN_DEGREE_THEN_FILL = _get_compiler_algorithm(recursive_conditioning, 'MIN_DEGREE_THEN_FILL')
40
+ RC_MIN_FILL = _get_compiler_algorithm(recursive_conditioning, 'MIN_FILL')
41
+ RC_MIN_FILL_THEN_DEGREE = _get_compiler_algorithm(recursive_conditioning, 'MIN_FILL_THEN_DEGREE')
42
+ RC_MIN_WEIGHTED_DEGREE = _get_compiler_algorithm(recursive_conditioning, 'MIN_WEIGHTED_DEGREE')
43
+ RC_MIN_WEIGHTED_FILL = _get_compiler_algorithm(recursive_conditioning, 'MIN_WEIGHTED_FILL')
44
+ RC_MIN_TRADITIONAL_WEIGHTED_FILL = _get_compiler_algorithm(recursive_conditioning, 'MIN_TRADITIONAL_WEIGHTED_FILL')
45
+
46
+ ACE = _get_compiler(ace)
47
47
 
48
48
  # @formatter:on
49
49
 
@@ -28,7 +28,7 @@ def compile_pgm(
28
28
  const_parameters: bool = True,
29
29
  *,
30
30
  algorithm: ClusterAlgorithm = MIN_FILL_THEN_DEGREE,
31
- pre_prune_factor_tables: bool = True,
31
+ pre_prune_factor_tables: bool = False,
32
32
  ) -> PGMCircuit:
33
33
  """
34
34
  Compile the PGM to an arithmetic circuit, using recursive conditioning.