diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 30eb6b4..1b2d58b 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -18,10 +18,7 @@ jobs: fail-fast: false matrix: version: - - '1.7' - - '1.8' - - '~1.9.0-0' - - 'nightly' + - '1.9' os: - ubuntu-latest arch: @@ -48,7 +45,7 @@ jobs: - uses: actions/checkout@v2 - uses: julia-actions/setup-julia@v1 with: - version: '1' + version: '1.9' - uses: julia-actions/julia-buildpkg@v1 - uses: julia-actions/julia-docdeploy@v1 env: diff --git a/Project.toml b/Project.toml index 71e609a..6e8a632 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "AlgorithmicRecourseDynamics" uuid = "3d1ede72-abb8-4340-bf8e-2ae06849b5ec" authors = ["Patrick Altmeyer"] -version = "0.1.3" +version = "0.1.4" [deps] CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b" @@ -9,7 +9,6 @@ CounterfactualExplanations = "2f13d31b-18db-44c1-bc43-ebaf2cff0be0" DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" Distances = "b4f34e82-e78d-54a5-968a-f98e89d6e8f7" Flux = "587475ba-b771-5e3f-ad9e-33799f191a9c" -Images = "916415d5-f1e6-5110-898d-aaa5f9f070e0" KernelFunctions = "ec8451be-7e33-11e9-00cf-bbf324bd1392" LazyArtifacts = "4af54fe1-eca0-43a8-85a7-787d91b784e3" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" @@ -17,9 +16,7 @@ Logging = "56ddb016-857b-54e1-b83d-db4d58db5568" MLJBase = "a7f614a8-145f-11e9-1d2a-a57a1082229d" MLUtils = "f1d291b0-491e-4a28-83b9-f70985020b54" Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a" -Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca" -RCall = "6f49c342-dc21-5d91-9882-a32aef131414" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" Serialization = "9e88b42a-f829-5b0c-bbe9-9e923198166b" Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" @@ -27,18 +24,15 @@ StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91" [compat] CSV = "0.10" -CounterfactualExplanations = "0.1" +CounterfactualExplanations = "=0.1.6" DataFrames = "1" Distances = "0.10" -Flux = "0.13" -Images = "0.25" +Flux = "0.13 - 0.14" KernelFunctions = "0.10" MLJBase = "0.21.3" -MLUtils = "0.3.1, 0.4" +MLUtils = "0.3.1 - 0.4" Parameters = "0.12" -Plots = "1.37.2" ProgressMeter = "1" -RCall = "0.13.14" StatsBase = "0.33" julia = "1.7, 1.8, 1.9" diff --git a/README.qmd b/README.qmd index 6c9552d..a5b1fd1 100644 --- a/README.qmd +++ b/README.qmd @@ -12,7 +12,9 @@ crossref: fig-prefix: Figure tbl-prefix: Table bibliography: bib.bib -jupyter: julia-1.8 +engine: julia +julia: + exeflags: ["+1.9"] --- [![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://juliatrustworthyai.github.io/AlgorithmicRecourseDynamics.jl/stable) @@ -20,9 +22,7 @@ jupyter: julia-1.8 [![Build Status](https://github.com/juliatrustworthyai/AlgorithmicRecourseDynamics.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/juliatrustworthyai/AlgorithmicRecourseDynamics.jl/actions/workflows/CI.yml?query=branch%3Amain) [![Coverage](https://codecov.io/gh/juliatrustworthyai/AlgorithmicRecourseDynamics.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/juliatrustworthyai/AlgorithmicRecourseDynamics.jl) [![Code Style: Blue](https://img.shields.io/badge/code%20style-blue-4495d1.svg)](https://github.com/invenia/BlueStyle) -[![ColPrac: Contributor’s Guide on Collaborative Practices for Community Packages](https://img.shields.io/badge/ColPrac-Contributor's%20Guide-blueviolet.png)](https://github.com/SciML/ColPrac) -[![Twitter Badge](https://img.shields.io/twitter/url/https/twitter.com/paltmey.svg?style=social&label=Follow%20%40paltmey)](https://twitter.com/paltmey) # AlgorithmicRecourseDynamics -{{< include docs/src/_intro.qmd >}} \ No newline at end of file +{{< include docs/src/_intro.qmd >}} diff --git a/_quarto.yml b/_quarto.yml index f7f40ee..b86dae7 100644 --- a/_quarto.yml +++ b/_quarto.yml @@ -14,7 +14,6 @@ execute: echo: true output: false -jupyter: julia-1.8 - - - +engines: ['julia'] +julia: + exeflags: ["+1.9"] diff --git a/src/experiments/functions.jl b/src/experiments/functions.jl index 74891a3..34267fd 100755 --- a/src/experiments/functions.jl +++ b/src/experiments/functions.jl @@ -172,14 +172,15 @@ function update_experiment!(experiment::Experiment, recourse_system::RecourseSys indices_ = rand(1:experiment.num_counterfactuals, length(results)) # randomly draw from generated counterfactuals X′ = reduce(hcat, @.(selectdim(counterfactual(results), 3, indices_))) y′ = reduce(hcat, @.(selectdim(counterfactual_label(results), 3, indices_))) + y′ = [y[1] for y in y′] - # If for any counterfactuals the returned label is NaN, this is considered as invalid and the current label is not updated: - valid_ces = vec(.!(isnan.(y′))) - chosen_individuals = chosen_individuals[valid_ces] + # If for any counterfactuals the returned label is NaN, this is considered as invalid and the current label is not updated: + valid_ces = vec(.!(isnan.(y′))) + chosen_individuals = chosen_individuals[valid_ces] - # Update data: - X[:, chosen_individuals] = X′[:, valid_ces] - y[:, chosen_individuals] = y′[:, valid_ces] + # Update data: + X[:, chosen_individuals] = X′[:, valid_ces] + y[:, chosen_individuals] = y′[:, valid_ces] # Generative model: gen_mod = deepcopy(counterfactual_data.generative_model) diff --git a/test/Project.toml b/test/Project.toml index 7e08923..ffd18ba 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -6,3 +6,8 @@ MLJBase = "a7f614a8-145f-11e9-1d2a-a57a1082229d" Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" + +[compat] +CounterfactualExplanations = "=0.1.6" +Flux = "0.13 - 0.14" + diff --git a/test/runtests.jl b/test/runtests.jl index e363d1e..325b4f4 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -26,6 +26,6 @@ using Test generators = Dict(:wachter => generator) experiment = set_up_experiment(data_train, data_test, models, generators) - run!(experiment) + run!(experiment, n_folds=1, n_rounds=5) end