-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathCRE.jl
32 lines (27 loc) · 833 Bytes
/
CRE.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
"""
Rule
A `Rule` is just a list of bounds for the different features. See also [`CRE`](@ref).
"""
struct Rule
bounds::Vector{Tuple}
end
"""
CRE <: AbstractCounterfactualExplanation
A Counterfactual Rule Explanation (CRE) is a global explanation for a given `target`, model `M`, `data` and `generator`.
"""
struct CRE <: AbstractCounterfactualExplanation
target::RawTargetType
data::DataPreprocessing.CounterfactualData
M::Models.AbstractModel
generator::Generators.AbstractGenerator
rules::Vector{Rule}
meta_rules::Union{Nothing,Vector{Rule}}
other::Union{Dict,Nothing}
end
"""
(cre::CRE)(x::AbstractArray)
Generates a local counterfactual point explanation for `x` using the `generator`.
"""
function (cre::CRE)(x::AbstractArray)
return cre(x::AbstractArray, cre.generator)
end