Skip to content

Commit

Permalink
Merge pull request #18 from JuliaTrustworthyAI/17-getting-and-error-f…
Browse files Browse the repository at this point in the history
…or-dice

17 getting and error for dice
  • Loading branch information
pat-alt authored Apr 4, 2024
2 parents 6c9bd5b + 401dd4d commit 27c913f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "TaijaPlotting"
uuid = "bd7198b4-c7d6-400c-9bab-9a24614b0240"
authors = ["Patrick Altmeyer"]
version = "1.0.8"
version = "1.0.9"

[deps]
CategoricalArrays = "324d7699-5711-5eae-9e2f-1d82baa6b597"
Expand Down
6 changes: 4 additions & 2 deletions src/CounterfactualExplations/data.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using MLUtils

function embed(data::CounterfactualData, X::AbstractArray = nothing; dim_red::Symbol = :pca)

# Training compressor:
Expand All @@ -20,9 +22,9 @@ function embed(data::CounterfactualData, X::AbstractArray = nothing; dim_red::Sy
end

# Transforming:
X = typeof(X) <: Vector{<:Matrix} ? hcat(X...) : X
X = typeof(X) <: Vector{<:Matrix} ? MLUtils.stack(X, dims=2) : X
if !isnothing(tfn) && !isnothing(X)
X = MultivariateStats.predict(tfn, X)
X = mapslices(x -> MultivariateStats.predict(tfn, x), X, dims = 1)
else
X = isnothing(X) ? X_train : X
end
Expand Down
11 changes: 11 additions & 0 deletions test/CounterfactualExplanations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ using TaijaData
plot(ce)
plot(ce; plot_proba = true, zoom = -0.1f32)
TaijaPlotting.animate_path(ce)

@test true

@testset "Multiple counterfactuals" begin
ce = generate_counterfactual(x, target, counterfactual_data, M, generator; num_counterfactuals = 5)
plot(ce)
@test true
end

end

@testset "Multi-dim" begin
Expand All @@ -43,6 +52,8 @@ using TaijaData
plot(M, counterfactual_data)
plot(ce)
TaijaPlotting.animate_path(ce)

@test true
end

@test true
Expand Down

2 comments on commit 27c913f

@pat-alt
Copy link
Member Author

@pat-alt pat-alt commented on 27c913f Apr 4, 2024

Choose a reason for hiding this comment

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

@JuliaRegistrator register

Release notes:

Small bug fix.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/104254

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.0.9 -m "<description of version>" 27c913fb8239971b3082d86f18a9865ce3e7c6ed
git push origin v1.0.9

Please sign in to comment.