Skip to content

Commit

Permalink
done
Browse files Browse the repository at this point in the history
  • Loading branch information
pat-alt committed Jan 2, 2025
1 parent 218b297 commit 8c01dc3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),

*Note*: We try to adhere to these practices as of version [v1.1.1].

## Version [1.4.2] - 2025-01-02

### Changed

- Small change to `validity` function: validity is now defined simply as the predicted label corresponding to the target label, independent of the predicted probability. [#508]

## Version [1.4.2] - 2024-12-31

### Changed
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "CounterfactualExplanations"
uuid = "2f13d31b-18db-44c1-bc43-ebaf2cff0be0"
authors = ["Patrick Altmeyer <[email protected]> and contributors"]
version = "1.4.2"
version = "1.4.3"

[deps]
CategoricalArrays = "324d7699-5711-5eae-9e2f-1d82baa6b597"
Expand Down
4 changes: 2 additions & 2 deletions src/evaluation/measures.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ include("plausibility/plausibility.jl")
"""
validity(ce::CounterfactualExplanation; γ=0.5)
Checks of the counterfactual search has been successful with respect to the probability threshold `γ`. In case multiple counterfactuals were generated, the function returns the proportion of successful counterfactuals.
Checks of the counterfactual search has been successful in that the predicted label corresponds to the specified target. In case multiple counterfactuals were generated, the function returns the proportion of successful counterfactuals.
"""
function validity(ce::CounterfactualExplanation; agg=Statistics.mean, γ=0.5)
val = agg(CounterfactualExplanations.target_probs(ce) .>= γ)
val = agg(CounterfactualExplanations.counterfactual_label(ce) .== ce.target)
val = val isa LinearAlgebra.AbstractMatrix ? vec(val) : val
return val
end
Expand Down

0 comments on commit 8c01dc3

Please sign in to comment.