Skip to content

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.
  • This will be kept the same. Type hints are offered manually in the code where it was used in detect_malicious_metadata_check.py
  • 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
  • This was raised as an issue on ProbLog's GitHub here, and has now been resolved with version 2.2.7.

@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
).

@art1f1c3R art1f1c3R force-pushed the art1f1c3R/suspicious-combo-refactor branch from 11187ad to 72e2608 Compare March 12, 2025 01:09
…ity, with better comments

Signed-off-by: Carl Flottmann <[email protected]>
@art1f1c3R art1f1c3R self-assigned this Mar 12, 2025
@art1f1c3R art1f1c3R merged commit f275e46 into staging Mar 12, 2025
10 checks passed
@art1f1c3R art1f1c3R deleted the art1f1c3R/suspicious-combo-refactor branch March 12, 2025 05:57
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.

2 participants