Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: use problog for suspicious combinations #997

Draft
wants to merge 2 commits into
base: staging
Choose a base branch
from

Conversation

art1f1c3R
Copy link
Member

@art1f1c3R art1f1c3R commented Mar 3, 2025

Refactor the SUSPICIOUS_COMBOS dictionary to instead use a problog model. The purpose of this is to simplify the dictionary into logical statements, and allow for future development of probabilistic rules. This model transforms the HeuristicResult types as follows:

  • HeuristicResult.FAIL results in <name> :- false.
  • HeuristicResult.PASS results in <name> :- true.
  • HeuristicResult.SKIP results in 0.0::<name>, which means any rules which require this heuristic do not trigger.

To do:

  • Simplify logical statements into a readable, yet simpler form

Current issues with including problog that need to be resolved:

  • problog has no typing stubs. Currently it's just been ignored in pyproject.toml.
  • problog currently causes the following warnings on tests:
=============================== warnings summary ===============================
.venv/lib/python3.11/site-packages/problog/setup.py:111
  /home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/problog/setup.py:111: DeprecationWarning: Use shutil.which instead of find_executable
    system_info["dsharp"] = distutils.spawn.find_executable("dsharp") is not None

.venv/lib/python3.11/site-packages/problog/setup.py:114
  /home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/problog/setup.py:114: DeprecationWarning: Use shutil.which instead of find_executable
    system_info["c2d"] = distutils.spawn.find_executable("cnf2dDNNF") is not None

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Mar 3, 2025
@art1f1c3R
Copy link
Member Author

Poll! What is the preferred way to represent each logical rule over multiple lines:
1.

<confidence_value>::<label> :-
    statement,
    statement,
    ...,
    statement.

or 2.

<confidence_value>::<label> :- (
    statement,
    statement,
    ...,
    statement
).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant