Settings
In this section, we detail the settings that can be used to configure PyReason. These settings can be used to control the behavior of the reasoning process.
Settings can be accessed using the following code:
import pyreason as pr
pr.settings.setting_name = value
Where setting_name is the name of the setting you want to change, and value is the value you want to set it to.
Below is a table of all the settings that can be changed in PyReason using the code above.
Note
All settings need to be modified before the reasoning process begins, otherwise they will not take effect.
To reset all settings to their default values, use the following code:
import pyreason as pr
pr.reset_settings()
Setting |
Default |
Description |
|
True |
Whether to print extra information
to screen during the reasoning process.
|
|
False |
Whether to output print statements
into a file.
|
|
‘pyreason_output’ |
The name the file output will be saved as
(only if
output_to_file = True). |
|
True |
Whether graph will be
parsed for attributes.
|
|
False |
Whether to abort reasoning as soon as an inconsistency
is detected in the interpretation instead of attempting
to resolve it automatically.
|
|
False |
Whether to profile PyReason’s maximum memory usage during
reasoning. When enabled, the run will print peak memory
consumption after completion.
|
|
False |
Whether the directed edges in the graph
will be reversed before reasoning.
|
|
False |
Whether to keep track of all ground atoms
which make the clauses true. NOTE: For large graphs
this can use up a lot of memory and slow down the runtime.
|
|
False |
Whether to save graph attribute facts to the
rule trace. This might make the trace files large because
there are generally many attributes in graphs.
|
|
False |
Whether the bounds in the interpretation are reset
to uncertain
[0,1] at each timestep or keeptheir value from the previous timestep.
|
|
True |
Whether to check for inconsistencies in the interpretation,
and resolve them if found. Inconsistencies are resolved by
resetting the bounds to
[0,1] and making the atom static. |
|
True |
Whether to make graph facts static. In other words, the
attributes in the graph remain constant throughout
the reasoning process.
|
|
True |
Whether to keep track of every change in the interpretation
so that helper APIs (rule trace, filtering utilities, queries)
can report the final state. Turning this off disables atom traces.
|
|
False |
Whether to use multiple CPU cores for inference.
This can greatly speed up runtime if running on a
cluster for large graphs.
|
|
‘intersection’ |
The mode for updating interpretations. Options are
'intersection'or
'override'. When using 'intersection', the resulting boundis the intersection of the new bound and the old bound. When using
'override', the resulting bound is the new bound. |
|
False |
Whether rules are allowed to contain ground atoms directly.
Enable this when using functions or literals that should bypass
standard grounding of variables.
|
|
False |
Whether to run the fixed-point (FP) reasoning engine instead of
the optimised incremental engine. The FP engine follows the
original PyReason semantics and is useful for validation.
|
Notes on Parallelism
PyReason is parallelized over rules, so for large rulesets it is recommended that this setting is used. However, for small rulesets, the overhead might be more than the speedup and it is worth checking the performance on your specific use case. When possible we recommend using the same number of cores (or a multiple) as the number of rules in the program.