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

Amend Metamorphic Relations #293

Closed
wants to merge 3 commits into from
Closed

Amend Metamorphic Relations #293

wants to merge 3 commits into from

Conversation

f-allian
Copy link
Contributor

  • Added a simple logic to the function generate_metamorphic_relations in specification/metamorphic_relation.py to deal with situations with dags that contain cycles/loops.
  • The added feature is a boolean parameter called skip_ancestors. The default is False which retains the original logic of the algorithm. If True, no adjustment sets are calculated and empty sets are passed into the ShouldCase/ShouldNotCause methods.
  • Logging is also used in the script's entry-point to warn the user to proceed with caution if this parameter is true.

TODO:

  • Write unit tests to validate the functionality of the algorithm when skip_ancestors=True

@f-allian f-allian added the enhancement New feature or request label Oct 21, 2024
@f-allian f-allian self-assigned this Oct 21, 2024
Copy link

github-actions bot commented Oct 21, 2024

🦙 MegaLinter status: ⚠️ WARNING

Descriptor Linter Files Fixed Errors Elapsed time
⚠️ PYTHON black 36 1 1.04s
✅ PYTHON pylint 36 0 5.36s

See detailed report in MegaLinter reports

MegaLinter is graciously provided by OX Security

Copy link

codecov bot commented Oct 21, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 7 lines in your changes missing coverage. Please review.

Project coverage is 96.54%. Comparing base (e6d46cd) to head (9d2fb23).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...usal_testing/specification/metamorphic_relation.py 66.66% 7 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #293      +/-   ##
==========================================
- Coverage   96.97%   96.54%   -0.43%     
==========================================
  Files          29       29              
  Lines        1816     1825       +9     
==========================================
+ Hits         1761     1762       +1     
- Misses         55       63       +8     
Files with missing lines Coverage Δ
...usal_testing/specification/metamorphic_relation.py 91.66% <66.66%> (-6.54%) ⬇️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update de0a676...9d2fb23. Read the comment docs.

def generate_metamorphic_relations(dag: CausalDAG) -> list[MetamorphicRelation]:
"""Construct a list of metamorphic relations implied by the Causal DAG.
def generate_metamorphic_relations(dag: CausalDAG, skip_ancestors: bool) -> list[MetamorphicRelation]:
"""Construct a list of metamorphic relations based on the DAG or cyclic graph.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unsure if actually relevant but in the literature a causal graph with loops is called a DCG (or you could just refer to either as a "causal graph". Pedantic suggestion though

@jmafoster1
Copy link
Contributor

I'm afraid I'm a little confused as to what's going on here. I was envisioning something along the lines of an ignore_cycles parameter which, if true, got all of the nodes that form part of any cycle and ignored (i.e. did not append it to the list of MRs) every test which had them as control, treatment, or a member of the adjustment set. I think simply ignoring the ancestors might not be strong enough.

@f-allian f-allian closed this Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants