diff --git a/experiments/jobscripts/generators/california_housing.sh b/experiments/jobscripts/generators/california_housing.sh index cd13e1c8451acd47a8353520e88ef467069f95c6..b0364af240ca728ebba95acc11e956ca990b1e12 100644 --- a/experiments/jobscripts/generators/california_housing.sh +++ b/experiments/jobscripts/generators/california_housing.sh @@ -2,7 +2,7 @@ #SBATCH --job-name="California Housing (ECCCo)" #SBATCH --time=3:00:00 -#SBATCH --ntasks=100 +#SBATCH --ntasks=1000 #SBATCH --cpus-per-task=1 #SBATCH --partition=compute #SBATCH --mem-per-cpu=4GB diff --git a/experiments/jobscripts/generators/credit_default.sh b/experiments/jobscripts/generators/credit_default.sh index 3f46774b937b69acbad95eaff2bdd7fded4eb753..93945bf1108f0a6109c61c6579a9ef1609972bf2 100644 --- a/experiments/jobscripts/generators/credit_default.sh +++ b/experiments/jobscripts/generators/credit_default.sh @@ -2,7 +2,7 @@ #SBATCH --job-name="Credit Default (ECCCo)" #SBATCH --time=3:00:00 -#SBATCH --ntasks=100 +#SBATCH --ntasks=1000 #SBATCH --cpus-per-task=1 #SBATCH --partition=compute #SBATCH --mem-per-cpu=4GB diff --git a/experiments/jobscripts/generators/german_credit.sh b/experiments/jobscripts/generators/german_credit.sh index f07bdd23e5827bb71dd248148cbb8fae09ad16ed..07bc4df73cb137d8262c99c69025520086a7a606 100644 --- a/experiments/jobscripts/generators/german_credit.sh +++ b/experiments/jobscripts/generators/german_credit.sh @@ -2,7 +2,7 @@ #SBATCH --job-name="German Credit (ECCCo)" #SBATCH --time=3:00:00 -#SBATCH --ntasks=100 +#SBATCH --ntasks=1000 #SBATCH --cpus-per-task=1 #SBATCH --partition=compute #SBATCH --mem-per-cpu=4GB diff --git a/experiments/jobscripts/generators/gmsc.sh b/experiments/jobscripts/generators/gmsc.sh index a9437ba3869717fc0b995530a1e9e841617be89a..d6c9223d7e3a2ab948ebf282bb5e1ef8403e937e 100644 --- a/experiments/jobscripts/generators/gmsc.sh +++ b/experiments/jobscripts/generators/gmsc.sh @@ -2,7 +2,7 @@ #SBATCH --job-name="GMSC (ECCCo)" #SBATCH --time=3:00:00 -#SBATCH --ntasks=100 +#SBATCH --ntasks=1000 #SBATCH --cpus-per-task=1 #SBATCH --partition=compute #SBATCH --mem-per-cpu=4GB diff --git a/experiments/jobscripts/generators/innovation/mnist.sh b/experiments/jobscripts/generators/innovation/mnist.sh new file mode 100644 index 0000000000000000000000000000000000000000..8823002ac8addd0a41b6f90d0b7d20dfb903aa25 --- /dev/null +++ b/experiments/jobscripts/generators/innovation/mnist.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +#SBATCH --job-name="MNIST (ECCCo)" +#SBATCH --time=24:00:00 +#SBATCH --ntasks=48 +#SBATCH --cpus-per-task=1 +#SBATCH --partition=compute +#SBATCH --mem-per-cpu=4GB +#SBATCH --account=innovation +#SBATCH --mail-type=END # Set mail type to 'END' to receive a mail when the job finishes. + +module load 2023r1 openmpi + +srun julia --project=experiments experiments/run_experiments.jl -- data=mnist output_path=results mpi > experiments/mnist.log diff --git a/experiments/jobscripts/generators/mnist.sh b/experiments/jobscripts/generators/mnist.sh index 17301eaaacfdbbce8747b31c8069b7e2c94e0f39..7f16991bd9e4076d46612b71dc2583f80cac7dcb 100644 --- a/experiments/jobscripts/generators/mnist.sh +++ b/experiments/jobscripts/generators/mnist.sh @@ -2,7 +2,7 @@ #SBATCH --job-name="MNIST (ECCCo)" #SBATCH --time=24:00:00 -#SBATCH --ntasks=100 +#SBATCH --ntasks=1000 #SBATCH --cpus-per-task=1 #SBATCH --partition=compute #SBATCH --mem-per-cpu=4GB diff --git a/experiments/jobscripts/generators/synthetic.sh b/experiments/jobscripts/generators/synthetic.sh index 4b47382dc9f27b09ebc8aedef4b7142209049b11..15e4f31079940c008852c050648d9af775568558 100644 --- a/experiments/jobscripts/generators/synthetic.sh +++ b/experiments/jobscripts/generators/synthetic.sh @@ -2,7 +2,7 @@ #SBATCH --job-name="Synthetic (ECCCo)" #SBATCH --time=02:00:00 -#SBATCH --ntasks=100 +#SBATCH --ntasks=1000 #SBATCH --cpus-per-task=1 #SBATCH --partition=compute #SBATCH --mem-per-cpu=4GB diff --git a/experiments/jobscripts/generators/tabular.sh b/experiments/jobscripts/generators/tabular.sh index dbd28c02aabc9df2bde3ea28a8c2168f6c5df66a..f7eae4eafcb1f4f110bdb22a2c3eb9717ec61c40 100644 --- a/experiments/jobscripts/generators/tabular.sh +++ b/experiments/jobscripts/generators/tabular.sh @@ -2,7 +2,7 @@ #SBATCH --job-name="Tabular (ECCCo)" #SBATCH --time=05:00:00 -#SBATCH --ntasks=100 +#SBATCH --ntasks=1000 #SBATCH --cpus-per-task=1 #SBATCH --partition=compute #SBATCH --mem-per-cpu=4GB diff --git a/experiments/jobscripts/tuning/generators/synthetic.sh b/experiments/jobscripts/tuning/generators/synthetic.sh index 51d52da10c84138bb898b3929a235d7a00c890ba..10246f049e008da2eb5ac2c30208c567e2f22cd7 100644 --- a/experiments/jobscripts/tuning/generators/synthetic.sh +++ b/experiments/jobscripts/tuning/generators/synthetic.sh @@ -2,7 +2,7 @@ #SBATCH --job-name="Grid-search Synthetic (ECCCo)" #SBATCH --time=03:00:00 -#SBATCH --ntasks=100 +#SBATCH --ntasks=1000 #SBATCH --cpus-per-task=1 #SBATCH --partition=compute #SBATCH --mem-per-cpu=4GB diff --git a/experiments/jobscripts/tuning/generators/tabular.sh b/experiments/jobscripts/tuning/generators/tabular.sh index 556d97ac636096b73d5b94153217f88b1f6a8b18..1aa26ced1280b314dbaef56b7195c9666fc59570 100644 --- a/experiments/jobscripts/tuning/generators/tabular.sh +++ b/experiments/jobscripts/tuning/generators/tabular.sh @@ -2,7 +2,7 @@ #SBATCH --job-name="Grid-search Tabular (ECCCo)" #SBATCH --time=06:00:00 -#SBATCH --ntasks=100 +#SBATCH --ntasks=1000 #SBATCH --cpus-per-task=1 #SBATCH --partition=compute #SBATCH --mem-per-cpu=4GB diff --git a/experiments/mnist.jl b/experiments/mnist.jl index a72e25dbd0e33b01a1114c3133395ae86f6ddc7f..0e509391d430d025a8006843da70e8a96f9bc9bc 100644 --- a/experiments/mnist.jl +++ b/experiments/mnist.jl @@ -1,4 +1,5 @@ # Training data: +dataname = "MNIST" n_obs = 10000 counterfactual_data = load_mnist(n_obs) counterfactual_data.X = ECCCo.pre_process.(counterfactual_data.X) @@ -11,39 +12,45 @@ counterfactual_data.generative_model = vae # Test data: test_data = load_mnist_test() +# Model tuning: +model_tuning_params = DEFAULT_MODEL_TUNING_LARGE + +# Tuning parameters: +tuning_params = DEFAULT_GENERATOR_TUNING + # Additional models: add_models = Dict( "LeNet-5" => lenet5, - "ResNet-18" => resnet18(;epochs=10), -) - -# Default builder: -n_hidden = 128 -activation = Flux.swish -builder = MLJFlux.@builder Flux.Chain( - Dense(n_in, n_hidden, activation), - Dense(n_hidden, n_out), + "ResNet-18" => resnet18(; epochs=10), ) -# Number of individuals: -n_ind = N_IND_SPECIFIED ? N_IND : 10 - -# Run: -run_experiment( - counterfactual_data, test_data; - dataname="MNIST", - builder= builder, - ð’Ÿx = Uniform(-1.0, 1.0), - α = [1.0,1.0,1e-2], - sampling_batch_size = 10, +# Parameter choices: +params = ( + n_ind = N_IND_SPECIFIED ? N_IND : 10, + builder=default_builder(n_hidden=128, n_layers=2, activation=Flux.swish), + ð’Ÿx=Uniform(-1.0, 1.0), + α=[1.0, 1.0, 1e-2], + sampling_batch_size=10, sampling_steps=50, - use_ensembling = true, - n_individuals = n_ind, - use_variants = false, - use_class_loss = true, + use_ensembling=true, + use_variants=false, additional_models=add_models, - epochs = 10, - nsamples = 10, + epochs=10, + nsamples=10, nmin=1, niter_eccco=100 -) \ No newline at end of file +) + +if !GRID_SEARCH + run_experiment( + counterfactual_data, test_data; + dataname=dataname, + params... + ) +else + grid_search( + counterfactual_data, test_data; + dataname=dataname, + tuning_params=tuning_params + ) +end \ No newline at end of file diff --git a/experiments/models/default_models.jl b/experiments/models/default_models.jl index ae009817cd60bdd04d2d60da4f743324d8a8a95c..c50ff0929fab5cc53a153f42c81409df6ece5522 100644 --- a/experiments/models/default_models.jl +++ b/experiments/models/default_models.jl @@ -18,7 +18,7 @@ end Default builder for MLPs. """ -function default_builder(n_hidden::Int=16, n_layers::Int=3, activation::Function=Flux.swish) +function default_builder(;n_hidden::Int=16, n_layers::Int=3, activation::Function=Flux.swish) builder = TuningBuilder(n_hidden=n_hidden, n_layers=n_layers, activation=activation) return builder end