Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
81112a5
updated to work with new margarine and same hyperparameters
htjb Aug 15, 2023
f7d2e4b
updates to benchmark tests
htjb Aug 16, 2023
09d6348
updated_benchmarks
htjb Aug 16, 2023
2660de1
updating error calcualtions
htjb Aug 16, 2023
29ea582
updating color map for figure 1
htjb Sep 13, 2023
6d6add9
removing old benchmarks prior to update
htjb Sep 13, 2023
1505c54
updating benchmark code
htjb Sep 13, 2023
62c9ace
updating benchmark epochs code
htjb Oct 11, 2023
0053808
Merge branch 'update-benchmarks' of github.com:htjb/piecewise_normali…
htjb Oct 11, 2023
e55e249
updated benchmarks with the logL fix and consistent hyperparameters
htjb Oct 11, 2023
141ac13
updating color map
htjb Oct 12, 2023
4f36c4c
codes to analyse the gas physical example
htjb Oct 12, 2023
eaff762
moving read_gas into physical benchmarks folder
htjb Oct 12, 2023
8555ef1
moving read gas file and mpi ifying it
htjb Oct 14, 2023
73fc008
updating miniboone code
htjb Oct 14, 2023
b8ac90e
bug fix
htjb Oct 16, 2023
b49733b
code to test different clustering algorithms
htjb Oct 16, 2023
8edf463
updating max number of clusters
htjb Oct 16, 2023
57120bd
updating numebr of repeats
htjb Oct 16, 2023
19f1361
trying different clustering methods
htjb Oct 16, 2023
0f7ae84
bug fix in clustering code
htjb Oct 16, 2023
e04c4dd
bug fix in cluster test
htjb Oct 16, 2023
bc65597
clustering results after bug fixing
htjb Oct 17, 2023
bd32164
hep example code
htjb Oct 17, 2023
7de57e4
evaluating KL on original samples for clustering tests
htjb Oct 17, 2023
6683085
fixing bug in kl code
htjb Oct 17, 2023
a748979
updating kl calculations
htjb Oct 17, 2023
b53bae0
updating benchmark kl calculation
htjb Oct 17, 2023
71c532c
Merge branch 'update-benchmarks' of github.com:htjb/piecewise_normali…
htjb Oct 17, 2023
a91288a
fiddling with pytorch
htjb Oct 17, 2023
585a725
bug fix in load of cgm cluster flow
htjb Oct 17, 2023
fda7dab
adjusting figure size
htjb Oct 17, 2023
4dde93d
some trained physical benchmark flows
htjb Oct 17, 2023
8ac756c
updating cluster figures
htjb Oct 17, 2023
acf2072
Merge branch 'update-benchmarks' of github.com:htjb/piecewise_normali…
htjb Oct 17, 2023
c5b38c8
updating file paths
htjb Oct 17, 2023
405ce39
thought the bottle neck was the log_prob calc but actually the cluste…
htjb Oct 18, 2023
79ab8c9
bug fix in the read_gas.py code
htjb Oct 18, 2023
7adf604
typo in title
htjb Jan 15, 2024
6a1d38f
updating physical examples
htjb Jan 15, 2024
ad29109
updating figure 1 typo
htjb Jan 15, 2024
98f9cae
code to test the RealNVP training time
htjb Jan 15, 2024
1bcfcee
better flow naming
htjb Jan 15, 2024
08e0968
adding realnvp to plot (need pnf super title for bottom six plots)
htjb Jan 15, 2024
a27dc22
fiddling with the clustering plot
htjb Jan 16, 2024
7379e2e
trying to get clustering plot nice
htjb Jan 16, 2024
2e340f2
making sure the clustering flows are all up to date;
htjb Jan 16, 2024
4522a1a
updating clustering plots and tidying code a little bit
htjb Jan 17, 2024
7b1f313
increasing number of samples for kl calculations
htjb Jan 19, 2024
3bea615
adding silhoutte score plot
htjb Jan 29, 2024
16cc0c2
adding a cost calcualtion
htjb Jan 30, 2024
e936900
fiddling around with the cost evaluation
htjb Jan 30, 2024
a834ca1
settling on a measure of cost to train
htjb Jan 30, 2024
56bddc5
bug fix in read resume
htjb Jan 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified Figures/figure1.pdf
Binary file not shown.
Binary file modified benchmark_duplicates/benchmarks_with_resampled_base_test_0.pdf
Binary file not shown.
Binary file modified benchmark_duplicates/benchmarks_with_resampled_base_test_1.pdf
Binary file not shown.
Binary file modified benchmark_duplicates/benchmarks_with_resampled_base_test_2.pdf
Binary file not shown.
Binary file modified benchmark_duplicates/benchmarks_with_resampled_base_test_3.pdf
Binary file not shown.
Binary file modified benchmark_duplicates/benchmarks_with_resampled_base_test_4.pdf
Binary file not shown.
Binary file modified benchmark_duplicates/benchmarks_with_resampled_base_test_5.pdf
Binary file not shown.
Binary file modified benchmark_duplicates/benchmarks_with_resampled_base_test_6.pdf
Binary file not shown.
Binary file modified benchmark_duplicates/benchmarks_with_resampled_base_test_7.pdf
Binary file not shown.
Binary file modified benchmark_duplicates/benchmarks_with_resampled_base_test_8.pdf
Binary file not shown.
Binary file modified benchmark_duplicates/benchmarks_with_resampled_base_test_9.pdf
Binary file not shown.
Binary file modified benchmark_duplicates/cgm_cluster_maf_0.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/cgm_cluster_maf_1.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/cgm_cluster_maf_2.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/cgm_cluster_maf_3.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/cgm_cluster_maf_4.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/cgm_cluster_maf_5.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/cgm_cluster_maf_6.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/cgm_cluster_maf_7.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/cgm_cluster_maf_8.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/cgm_cluster_maf_9.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/cgm_realnvp_resampled_base_0.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/cgm_realnvp_resampled_base_1.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/cgm_realnvp_resampled_base_2.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/cgm_realnvp_resampled_base_3.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/cgm_realnvp_resampled_base_4.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/cgm_realnvp_resampled_base_5.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/cgm_realnvp_resampled_base_6.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/cgm_realnvp_resampled_base_7.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/cgm_realnvp_resampled_base_8.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/cgm_realnvp_resampled_base_9.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/cgm_single_maf_0.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/cgm_single_maf_1.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/cgm_single_maf_2.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/cgm_single_maf_3.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/cgm_single_maf_4.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/cgm_single_maf_5.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/cgm_single_maf_6.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/cgm_single_maf_7.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/cgm_single_maf_8.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/cgm_single_maf_9.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/rm_cluster_maf_0.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/rm_cluster_maf_1.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/rm_cluster_maf_2.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/rm_cluster_maf_3.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/rm_cluster_maf_4.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/rm_cluster_maf_5.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/rm_cluster_maf_6.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/rm_cluster_maf_7.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/rm_cluster_maf_8.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/rm_cluster_maf_9.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/rm_realnvp_resampled_base_0.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/rm_realnvp_resampled_base_1.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/rm_realnvp_resampled_base_2.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/rm_realnvp_resampled_base_3.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/rm_realnvp_resampled_base_4.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/rm_realnvp_resampled_base_5.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/rm_realnvp_resampled_base_6.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/rm_realnvp_resampled_base_7.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/rm_realnvp_resampled_base_8.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/rm_realnvp_resampled_base_9.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/rm_single_maf_0.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/rm_single_maf_1.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/rm_single_maf_2.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/rm_single_maf_3.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/rm_single_maf_4.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/rm_single_maf_5.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/rm_single_maf_6.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/rm_single_maf_7.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/rm_single_maf_8.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/rm_single_maf_9.pkl
Binary file not shown.
781 changes: 781 additions & 0 deletions benchmark_duplicates/slurm-29410985.out

Large diffs are not rendered by default.

Binary file modified benchmark_duplicates/tm_cluster_maf_0.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/tm_cluster_maf_1.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/tm_cluster_maf_2.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/tm_cluster_maf_3.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/tm_cluster_maf_4.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/tm_cluster_maf_5.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/tm_cluster_maf_6.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/tm_cluster_maf_7.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/tm_cluster_maf_8.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/tm_cluster_maf_9.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/tm_realnvp_resampled_base_0.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/tm_realnvp_resampled_base_1.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/tm_realnvp_resampled_base_2.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/tm_realnvp_resampled_base_3.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/tm_realnvp_resampled_base_4.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/tm_realnvp_resampled_base_5.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/tm_realnvp_resampled_base_6.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/tm_realnvp_resampled_base_7.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/tm_realnvp_resampled_base_8.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/tm_realnvp_resampled_base_9.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/tm_single_maf_0.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/tm_single_maf_1.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/tm_single_maf_2.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/tm_single_maf_3.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/tm_single_maf_4.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/tm_single_maf_5.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/tm_single_maf_6.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/tm_single_maf_7.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/tm_single_maf_8.pkl
Binary file not shown.
Binary file modified benchmark_duplicates/tm_single_maf_9.pkl
Binary file not shown.
248 changes: 146 additions & 102 deletions benchmarks.py

Large diffs are not rendered by default.

400 changes: 400 additions & 0 deletions clustering.py

Large diffs are not rendered by default.

Binary file added clustering/clustering_0.pdf
Binary file not shown.
Binary file added clustering/clustering_1.pdf
Binary file not shown.
Binary file added clustering/clustering_2.pdf
Binary file not shown.
Binary file added clustering/clustering_3.pdf
Binary file not shown.
Binary file added clustering/clustering_4.pdf
Binary file not shown.
Binary file added clustering/clustering_5.pdf
Binary file not shown.
Binary file added clustering/clustering_6.pdf
Binary file not shown.
Binary file added clustering/clustering_7.pdf
Binary file not shown.
Binary file added clustering/clustering_8.pdf
Binary file not shown.
Binary file added clustering/clustering_9.pdf
Binary file not shown.
Binary file added clustering/rm_agglomerative_clustering_maf_0.pkl
Binary file not shown.
Binary file added clustering/rm_agglomerative_clustering_maf_1.pkl
Binary file not shown.
Binary file added clustering/rm_agglomerative_clustering_maf_2.pkl
Binary file not shown.
Binary file added clustering/rm_agglomerative_clustering_maf_3.pkl
Binary file not shown.
Binary file added clustering/rm_agglomerative_clustering_maf_4.pkl
Binary file not shown.
Binary file added clustering/rm_agglomerative_clustering_maf_5.pkl
Binary file not shown.
Binary file added clustering/rm_agglomerative_clustering_maf_6.pkl
Binary file not shown.
Binary file added clustering/rm_agglomerative_clustering_maf_7.pkl
Binary file not shown.
Binary file added clustering/rm_agglomerative_clustering_maf_8.pkl
Binary file not shown.
Binary file added clustering/rm_agglomerative_clustering_maf_9.pkl
Binary file not shown.
Binary file added clustering/rm_birch_clustering_maf_0.pkl
Binary file not shown.
Binary file added clustering/rm_birch_clustering_maf_1.pkl
Binary file not shown.
Binary file added clustering/rm_birch_clustering_maf_2.pkl
Binary file not shown.
Binary file added clustering/rm_birch_clustering_maf_3.pkl
Binary file not shown.
Binary file added clustering/rm_birch_clustering_maf_4.pkl
Binary file not shown.
Binary file added clustering/rm_birch_clustering_maf_5.pkl
Binary file not shown.
Binary file added clustering/rm_birch_clustering_maf_6.pkl
Binary file not shown.
Binary file added clustering/rm_birch_clustering_maf_7.pkl
Binary file not shown.
Binary file added clustering/rm_birch_clustering_maf_8.pkl
Binary file not shown.
Binary file added clustering/rm_birch_clustering_maf_9.pkl
Binary file not shown.
Binary file added clustering/rm_kmeans_maf_0.pkl
Binary file not shown.
Binary file added clustering/rm_kmeans_maf_1.pkl
Binary file not shown.
Binary file added clustering/rm_kmeans_maf_2.pkl
Binary file not shown.
Binary file added clustering/rm_kmeans_maf_3.pkl
Binary file not shown.
Binary file added clustering/rm_kmeans_maf_4.pkl
Binary file not shown.
Binary file added clustering/rm_kmeans_maf_5.pkl
Binary file not shown.
Binary file added clustering/rm_kmeans_maf_6.pkl
Binary file not shown.
Binary file added clustering/rm_kmeans_maf_7.pkl
Binary file not shown.
Binary file added clustering/rm_kmeans_maf_8.pkl
Binary file not shown.
Binary file added clustering/rm_kmeans_maf_9.pkl
Binary file not shown.
Binary file added clustering/rm_mean_shift_maf_0.pkl
Binary file not shown.
Binary file added clustering/rm_mean_shift_maf_1.pkl
Binary file not shown.
Binary file added clustering/rm_mean_shift_maf_2.pkl
Binary file not shown.
Binary file added clustering/rm_mean_shift_maf_3.pkl
Binary file not shown.
Binary file added clustering/rm_mean_shift_maf_4.pkl
Binary file not shown.
Binary file added clustering/rm_mean_shift_maf_5.pkl
Binary file not shown.
Binary file added clustering/rm_mean_shift_maf_6.pkl
Binary file not shown.
Binary file added clustering/rm_mean_shift_maf_7.pkl
Binary file not shown.
Binary file added clustering/rm_mean_shift_maf_8.pkl
Binary file not shown.
Binary file added clustering/rm_mean_shift_maf_9.pkl
Binary file not shown.
Binary file added clustering/rm_minibatch_kmeans_maf_0.pkl
Binary file not shown.
Binary file added clustering/rm_minibatch_kmeans_maf_1.pkl
Binary file not shown.
Binary file added clustering/rm_minibatch_kmeans_maf_2.pkl
Binary file not shown.
Binary file added clustering/rm_minibatch_kmeans_maf_3.pkl
Binary file not shown.
Binary file added clustering/rm_minibatch_kmeans_maf_4.pkl
Binary file not shown.
Binary file added clustering/rm_minibatch_kmeans_maf_5.pkl
Binary file not shown.
Binary file added clustering/rm_minibatch_kmeans_maf_6.pkl
Binary file not shown.
Binary file added clustering/rm_minibatch_kmeans_maf_7.pkl
Binary file not shown.
Binary file added clustering/rm_minibatch_kmeans_maf_8.pkl
Binary file not shown.
Binary file added clustering/rm_minibatch_kmeans_maf_9.pkl
Binary file not shown.
Binary file added clustering/rm_realnvp_resampled_base_0.pkl
Binary file not shown.
Binary file added clustering/rm_single_maf_0.pkl
Binary file not shown.
Binary file added clustering/rm_single_maf_1.pkl
Binary file not shown.
Binary file added clustering/rm_single_maf_2.pkl
Binary file not shown.
Binary file added clustering/rm_single_maf_3.pkl
Binary file not shown.
Binary file added clustering/rm_single_maf_4.pkl
Binary file not shown.
Binary file added clustering/rm_single_maf_5.pkl
Binary file not shown.
Binary file added clustering/rm_single_maf_6.pkl
Binary file not shown.
Binary file added clustering/rm_single_maf_7.pkl
Binary file not shown.
Binary file added clustering/rm_single_maf_8.pkl
Binary file not shown.
Binary file added clustering/rm_single_maf_9.pkl
Binary file not shown.
Binary file added clustering/rm_spectral_clustering_maf_0.pkl
Binary file not shown.
Binary file added clustering/rm_spectral_clustering_maf_1.pkl
Binary file not shown.
Binary file added clustering/rm_spectral_clustering_maf_2.pkl
Binary file not shown.
Binary file added clustering/rm_spectral_clustering_maf_3.pkl
Binary file not shown.
Binary file added clustering/rm_spectral_clustering_maf_4.pkl
Binary file not shown.
Binary file added clustering/rm_spectral_clustering_maf_5.pkl
Binary file not shown.
Binary file added clustering/rm_spectral_clustering_maf_6.pkl
Binary file not shown.
Binary file added clustering/rm_spectral_clustering_maf_7.pkl
Binary file not shown.
Binary file added clustering/rm_spectral_clustering_maf_8.pkl
Binary file not shown.
Binary file added clustering/rm_spectral_clustering_maf_9.pkl
Binary file not shown.
51 changes: 51 additions & 0 deletions clustering/slurm-29848070.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
Loading rhel8/default-icl
Loading requirement: dot rhel8/slurm singularity/current rhel8/global
cuda/11.4 vgl/3.1/64 intel-oneapi-compilers/2022.1.0/gcc/b6zld2mz
intel-oneapi-mpi/2021.6.0/intel/guxuvcpm
Changed directory to /rds/user/htjb2/hpc-work/piecewise-normalizing-flows-reviews.

JobID: 29848070
======
Time: Tue 17 Oct 12:09:52 BST 2023
Running on master node: cpu-q-88
Current directory: /rds/user/htjb2/hpc-work/piecewise-normalizing-flows-reviews

Nodes allocated:
================
cpu-q-88

numtasks=76, numnodes=1, mpi_tasks_per_node=76 (OMP_NUM_THREADS=1)

Executing command:
==================
python clustering.py

2023-10-17 12:09:58.630128: I tensorflow/core/util/port.cc:110] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
2023-10-17 12:09:58.840275: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 AVX512F AVX512_VNNI FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
2023-10-17 12:10:01.003094: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
2023-10-17 12:10:07.092746: E tensorflow/compiler/xla/stream_executor/cuda/cuda_driver.cc:268] failed call to cuInit: CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected
2023-10-17 12:10:08.231180: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0xc5e0710 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2023-10-17 12:10:08.231363: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version
2023-10-17 12:10:08.322517: I tensorflow/compiler/mlir/tensorflow/utils/dump_mlir_util.cc:255] disabling MLIR crash reproducer, set env var `MLIR_CRASH_REPRODUCER_DIRECTORY` to enable.
2023-10-17 12:10:08.800507: I ./tensorflow/compiler/jit/device_compiler.h:186] Compiled cluster using XLA! This line is logged at most once for the lifetime of the process.
2023-10-17 12:10:09.222538: W tensorflow/compiler/tf2xla/kernels/random_ops.cc:57] Warning: Using tf.random.uniform with XLA compilation will ignore seeds; consider using tf.random.stateless_uniform instead if reproducible behavior is desired. random_uniform/RandomUniform
WARNING:tensorflow:5 out of the last 5 calls to <function MAF.log_prob at 0x14bc798403a0> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has reduce_retracing=True option that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/guide/function#controlling_retracing and https://www.tensorflow.org/api_docs/python/tf/function for more details.
WARNING:tensorflow:6 out of the last 6 calls to <function MAF.log_prob at 0x14bc798769d0> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has reduce_retracing=True option that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/guide/function#controlling_retracing and https://www.tensorflow.org/api_docs/python/tf/function for more details.
WARNING:tensorflow:5 out of the last 6 calls to <function clusterMAF.__call__ at 0x14bc7861b280> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has reduce_retracing=True option that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/guide/function#controlling_retracing and https://www.tensorflow.org/api_docs/python/tf/function for more details.
WARNING:tensorflow:6 out of the last 7 calls to <function clusterMAF.__call__ at 0x14bc900443a0> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has reduce_retracing=True option that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/guide/function#controlling_retracing and https://www.tensorflow.org/api_docs/python/tf/function for more details.
/rds/user/htjb2/hpc-work/piecewise-normalizing-flows-reviews/myenv/lib/python3.8/site-packages/margarine/clustered.py:174: UserWarning: The number of clusters is 20. This is the maximum number of clusters that can be used. If you require more clusters, please specify the 'cluster_number' kwarg. margarine will continue with 20 clusters.
warnings.warn("The number of clusters is 20. " +
WARNING:tensorflow:5 out of the last 5 calls to <function MAF.__call__ at 0x14bc56997670> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has reduce_retracing=True option that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/guide/function#controlling_retracing and https://www.tensorflow.org/api_docs/python/tf/function for more details.
WARNING:tensorflow:5 out of the last 5 calls to <function MAF.sample at 0x14bc544d33a0> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has reduce_retracing=True option that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/guide/function#controlling_retracing and https://www.tensorflow.org/api_docs/python/tf/function for more details.
WARNING:tensorflow:6 out of the last 6 calls to <function MAF.__call__ at 0x14bbe53c7ee0> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has reduce_retracing=True option that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/guide/function#controlling_retracing and https://www.tensorflow.org/api_docs/python/tf/function for more details.
WARNING:tensorflow:6 out of the last 6 calls to <function MAF.sample at 0x14bbe7508700> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has reduce_retracing=True option that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/guide/function#controlling_retracing and https://www.tensorflow.org/api_docs/python/tf/function for more details.
/rds/user/htjb2/hpc-work/piecewise-normalizing-flows-reviews/myenv/lib/python3.8/site-packages/margarine/clustered.py:174: UserWarning: The number of clusters is 20. This is the maximum number of clusters that can be used. If you require more clusters, please specify the 'cluster_number' kwarg. margarine will continue with 20 clusters.
warnings.warn("The number of clusters is 20. " +
maf 0.04031182 0.028188227102607325
kmeans 0.036751173 0.014605213892256943
minbatchkmeans 0.036751173 0.014605213892256943
mean_shift 0.039975084 0.016644943875773675
spectral_clustering 0.80715007 0.07794943311681986
agglomerative_clustering 0.4231082 0.06230989730486836
birch 0.035159063 0.014266189726573182
73 changes: 73 additions & 0 deletions datasets/gas.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

import datasets


class GAS:

class Data:

def __init__(self, data):

self.x = data.astype(np.float32)
self.N = self.x.shape[0]

def __init__(self):

file = 'raw_physical_data/gas/ethylene_CO.pickle'
trn, val, tst = load_data_and_clean_and_split(file)

self.trn = self.Data(trn)
self.val = self.Data(val)
self.tst = self.Data(tst)

self.n_dims = self.trn.x.shape[1]


def load_data(file):

data = pd.read_pickle(file)
# data = pd.read_pickle(file).sample(frac=0.25)
# data.to_pickle(file)
data.drop("Meth", axis=1, inplace=True)
data.drop("Eth", axis=1, inplace=True)
data.drop("Time", axis=1, inplace=True)
return data


def get_correlation_numbers(data):
C = data.corr()
A = C > 0.98
B = A.values.sum(axis=1)
return B


def load_data_and_clean(file):

data = load_data(file)
B = get_correlation_numbers(data)

while np.any(B > 1):
col_to_remove = np.where(B > 1)[0][0]
col_name = data.columns[col_to_remove]
data.drop(col_name, axis=1, inplace=True)
B = get_correlation_numbers(data)
# print(data.corr())
data = (data-data.mean())/data.std()

return data


def load_data_and_clean_and_split(file):

data = load_data_and_clean(file).values
N_test = int(0.1*data.shape[0])
data_test = data[-N_test:]
data_train = data[0:-N_test]
N_validate = int(0.1*data_train.shape[0])
data_validate = data_train[-N_validate:]
data_train = data_train[0:-N_validate]

return data_train, data_validate, data_test
17 changes: 9 additions & 8 deletions figure1.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from anesthetic import MCMCSamples
import matplotlib.pyplot as plt
from margarine.maf import MAF
from margarine.clustered import clusterMAF

# generate a set of multi-modal samples
nsamples = 5000
Expand All @@ -17,32 +18,32 @@
fig, axes = plt.subplots(1, 3, figsize=(6.3, 3))

# plot original samples
axes[0].hist2d(data[:, 0], data[:, 1], bins=80)
axes[0].hist2d(data[:, 0], data[:, 1], bins=80, cmap='Blues')

# try and load the example maf only flow else generate and plot samples
try:
bij = MAF.load("figure1_normal_maf.pkl")
except:
bij = MAF(samples[names].values,
samples.get_weights().astype('float64'))
weights=samples.get_weights().astype('float64'))
bij.train(10000, early_stop=True)
bij.save("figure1_normal_maf.pkl")
bij_samples = bij.sample(nsamples)
axes[1].hist2d(bij_samples[:, 0], bij_samples[:, 1], bins=80)
axes[1].hist2d(bij_samples[:, 0], bij_samples[:, 1], bins=80, cmap='Blues')

# try and load the example cluster maf only flow else generate and plot samples
try:
bij = MAF.load("figure1_cluster.pkl")
bij = clusterMAF.load("figure1_cluster.pkl")
except:
bij = MAF(samples[names].values,
samples.get_weights().astype('float64'), clustering=True)
bij = clusterMAF(samples[names].values,
weights=samples.get_weights().astype('float64'), clustering=True)
bij.train(10000, early_stop=True)
bij.save("figure1_cluster.pkl")
bij_samples = bij.sample(nsamples)
axes[2].hist2d(bij_samples[:, 0], bij_samples[:, 1], bins=80)
axes[2].hist2d(bij_samples[:, 0], bij_samples[:, 1], bins=80, cmap='Blues')

# formatting
title = ['Target.', 'MAF\nGaussian Base\ne.g. Papamakarios et al. 2017',
title = ['Target', 'MAF\nGaussian Base\ne.g. Papamakarios et al. 2017',
'Piecewise MAF\nGaussian Base\nThis work']
for i in range(len(axes)):
axes[i].set_xticks([])
Expand Down
Binary file modified figure1_cluster.pkl
Binary file not shown.
Binary file modified figure1_normal_maf.pkl
Binary file not shown.
Binary file added figure2.pdf
Binary file not shown.
47 changes: 38 additions & 9 deletions figure2.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,23 @@
from target_dists_stimper import CircularGaussianMixture
from sklearn.metrics import silhouette_score
from sklearn.cluster import KMeans
from matplotlib import rc
import matplotlib as mpl

# figure formatting
mpl.rcParams['axes.prop_cycle'] = mpl.cycler('color',
['ff7f00', '984ea3', '999999', '377eb8',
'4daf4a','f781bf', 'a65628', 'e41a1c', 'dede00'])
mpl.rcParams['text.usetex'] = True
#mpl.rcParams['text.latex.preamble'] = [
# r'\usepackage{amsmath}',
# r'\usepackage{amssymb}']
rc('font', family='serif')
rc('font', serif='cm')
rc('savefig', pad_inches=0.05)

# generate example samples
nsample = 10000
nsample = 1000
cgm = CircularGaussianMixture()
s = cgm.sample(nsample).numpy()

Expand All @@ -24,7 +38,16 @@
print(cluster_number)

# plot a few examples of the clustering and the corresponding score.
fig, axes = plt.subplots(2, 3, figsize=(6.3, 4))
fig = plt.figure(constrained_layout=True, figsize=(6.3, 4))
gs = fig.add_gridspec(2, 5, width_ratios=[1, 1, 1, 0.8, 0.8])

axes = []
for i in range(2):
ax = []
for j in range(3):
ax.append(fig.add_subplot(gs[i, j]))
axes.append(ax)
axes = np.array(axes)

cmap = 'inferno'

Expand All @@ -36,18 +59,24 @@

axes[1, 2].scatter(s[:, 0], s[:, 1], c=labels[10], s=1, cmap=cmap)

axes[0, 0].set_title(r'$k=2, s=$' + '{:.3f}'.format(-losses[0]))
axes[0, 1].set_title(r'$k=4, s=$' + '{:.3f}'.format(-losses[2]))
axes[0, 2].set_title(r'$k=6, s=$' + '{:.3f}'.format(-losses[4]))
axes[1, 0].set_title(r'$k=8, s=$' + '{:.3f}'.format(-losses[6]))
axes[1, 1].set_title(r'$k=10, s=$' + '{:.3f}'.format(-losses[8]))
axes[1, 2].set_title(r'$k=12, s=$' + '{:.3f}'.format(-losses[10]))
axes[0, 0].set_title(r'$k=2$,' +'\n' + r'$s=$' + '{:.3f}'.format(-losses[0]), fontsize=10)
axes[0, 1].set_title(r'$k=4$,' +'\n' + r'$s=$' + '{:.3f}'.format(-losses[2]), fontsize=10)
axes[0, 2].set_title(r'$k=6$,' +'\n' + r'$s=$' + '{:.3f}'.format(-losses[4]), fontsize=10)
axes[1, 0].set_title(r'$k=8$,' +'\n' + r'$s=$' + '{:.3f}'.format(-losses[6]), fontsize=10)
axes[1, 1].set_title(r'$k=10$,' +'\n' + r'$s=$' + '{:.3f}'.format(-losses[8]), fontsize=10)
axes[1, 2].set_title(r'$k=12$,' +'\n' + r'$s=$' + '{:.3f}'.format(-losses[10]), fontsize=10)

for i in range(2):
for j in range(3):
axes[i, j].set_xticks([])
axes[i, j].set_yticks([])

plt.tight_layout()
ax = fig.add_subplot(gs[:, 3:])
ax.plot(ks, -losses, 'o-', c='k')
ax.set_xlabel('Number of clusters')
ax.set_ylabel('Silhouette score')
ax.set_xticks(ks[::2])

#plt.tight_layout()
plt.savefig('figure2.pdf', dpi=300)
plt.show()
Loading