-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
implement soft_eq
and soft_neq
#472
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
eb8680
approved these changes
Jan 5, 2024
This was referenced Jan 10, 2024
rfl-urbaniak
added a commit
that referenced
this pull request
Jan 12, 2024
* removed explanation code (#411) * add `preempt` and its tests (#414) * added preempt and its tests * refactored test to use new code * lint * added uniform proposal (#416) * add consequent_differs and a test thereof (#418) * added preempt and its tests * refactored test to use new code * lint * added consequent_differs and a test thereof --------- Co-authored-by: eb8680 <eb8680@users.noreply.github.com> * add Preemptions and a test thereof (#420) * added preempt and its tests * refactored test to use new code * lint * added Preemptions and a test thereof * added `undo_split` and a test thereof (#422) * import --------- Co-authored-by: Eli <eli@elibingham.com> * added SplitSubsets and a test thereof (#424) * added preempt and its tests * refactored test to use new code * lint * added Preemptions and a test thereof * added `undo_split` and a test thereof * added SplitSubsets and a test thereof * added `undo_split` and a test thereof (#422) * import --------- Co-authored-by: Eli <eli@elibingham.com> Co-authored-by: eb8680 <eb8680@users.noreply.github.com> * added `random intervention` and a test thereof (#442) * add `SearchForExplanation` (#445) * added `random intervention` and a test thereof * added `SearchForExplanation` and a test thereof --------- Co-authored-by: eb8680 <eb8680@users.noreply.github.com> * explainable documentation update (#457) * docstrings update WIP * small typo * Remove explainable references from chirho.counterfactual (#458) * implement `soft_eq` and `soft_neq` (#472) * add soft_neq and a few tests in test_ops * sof eq WIP * conversion to soft_eq * defaulting soft_eq scale to .1 * Tavares conditions have landed * soft_neq with tests * added docstring for soft_neq * refactor soft_eq and soft_neq * tests * remove failing tests * comment * sign * move soft_neq to internals for now * nit * remove comment --------- Co-authored-by: Eli <eli@elibingham.com> * Add explainable module to Sphinx build (#481) * Add explainable module to sphinx build * Add explainable module to sphinx build * Reorganize code in chirho.explainable (#485) * Add explainable module to sphinx build * Add explainable module to sphinx build * reorganize codebase * remove empty file * rename alternatives * reorganize test files * sphinx * remove test_defaults * implement soft_neq and use downstream in the explainable module (#490) * that's it * lint * lint * preemptions type as required by runner lint * persistent lint typing error, using Any * reverting to Preemptions * add revised actual causality notebook (#446) * added `random intervention` and a test thereof * added `SearchForExplanation` and a test thereof * added ac notebook with a test * small cleanup * that's it * rerun actual causality and added it to rst * actual causality nb WIP * lint * proofreading * lint * preemptions type as required by runner lint * persistent lint typing error, using Any * reverting to Preemptions * lint, add actual_causality to notebook tests again * removed redundant alternatives.py * remove redundant split_subset.py * fixing docstrings * format & lint * pulled explanation from ru-propagate-... * docstrings in explanation.py * typo in ac nb --------- Co-authored-by: eb8680 <eb8680@users.noreply.github.com> * allow for empty witness in SearchForCause (#491) * allow for empty witness in SearchForCause * removed mwc_empty from a test * allow empty ant and con * Implement `InferConstraints` (#493) * experiment done * cleanup, docstring * eliminate args from ExtractSupport, move to components * lint --------- Co-authored-by: eb8680 <eb8680@users.noreply.github.com> Co-authored-by: Eli <eli@elibingham.com>
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When all consequent variables are binary, the factor applied to the consequent variable can only be non-equality (
c_observed != c_alternative
). However, when the consequent variables are not binary, different approximations of this potentially measure-0 condition may lead to different conclusions, and it is not always obvious which one to choose.A common choice in work on counterfactual explanations in machine learning is a simple choice of distance measure or divergence that depends on the support of the consequent. To capture this, we define a support-dependent helper function
soft_neq
to be used in the helper functionconsequent_differs
, and an analogoussoft_eq
function to be used in the antecedent proposal evaluation.The key constraints we want the functions to satisfy are counterparts of the predicate relaxation conditions as introduced in "Predicate exchange..." by Tavares et al. Additional constraints related to the more general behavior of the
explainable
module are formulated intests.explainable.test_ops
.