Reproducibility code for Norm-Adaptive Maximum Mean Discrepancy, presented at ICML 2026. This work is done by
- Zhijian Zhou (unimelb) zhijianzhou.ml@gmail.com
- Liuhua Peng (unimelb) liuhua.peng@unimelb.edu.au
- Xunye Tian (unimelb) xunyetian.ml@gmail.com
- Feng Liu (unimelb) fengliu.ml@gmail.com
The code is organized around the important experiments in the paper.
Install the dependencies from environment.yml.
Most scripts write text results under Results/... relative to the repository
root. Before running experiments, create the result folders used by the scripts:
mkdir -p Results/tst_sample_size/test_power Results/tst_sample_size/typeI_error
mkdir -p Results/power_tv/test_power Results/power_tv/typeI_error
mkdir -p Results/power_epsn
mkdir -p Results/demosMany experiments are GPU-oriented and use torch.device("cuda") by default.
For quick CPU checks, override the device in the relevant script or argument.
Run the reference-sample kernel-selection demo:
python demos/mixture_gaussian_dct.pyThe demo uses Gaussian mixtures where the alternative pair has a modestly
larger signed mixture contrast than the reference pair. MMD therefore has real
power, while NAMMD is stronger because its normalization captures the change in
the RKHS norm structure. The MMD and NAMMD Gaussian bandwidths are selected
from independent pilot samples. Because this is a synthetic demo, the tolerance
level epsilon is the population value of the reference pair. For each test
sample, the rejection threshold is computed from that test sample's asymptotic
variance, as in the DCT procedure. CSV summaries are written to
Results/demos/.
Script:
python "Figure 1.py"Outputs are written to pictures/, including
pictures/Figure1_continuous_gmm.pdf and the corresponding CSV summary.
Directory:
TST_exp/tst_sample_size/
Main NAMMD method:
cd TST_exp/tst_sample_size
python NAMMDFuse.pyBaselines used for the same figure:
python MMDFuse.py
python MMDAgg.py
python MEmabid.py
python MMD_D.py
python ACTT.py
python AutoTST.py
python AutoTST_deep.pyThese scripts save raw rejection-rate summaries to
Results/tst_sample_size/.... Figure plotting is not centralized in this repo;
the text outputs are the experiment artifacts used to build the figure.
Directory:
DCT_exp/power_tv/
Run the dataset scripts:
cd DCT_exp/power_tv
python blob.py
python higgs.py
python hdgm.py
python mnist.py
python cifar.pyThe default --check 1 setting reports power. Scripts with --check 0 report
the corresponding type-I error for the same construction.
Directory:
DCT_exp/power_epsn/
Run the dataset scripts:
cd DCT_exp/power_epsn
python blob.py
python higgs.py
python hdgm.py
python mnist.py
python cifar.pyThis is the main continuous/high-dimensional DCT comparison between MMD-based DCT and NAMMD-based DCT. The Gaussian bandwidths for MMD and NAMMD are selected separately from reference samples.
Directory:
DA_exp/
Feature generation:
cd DA_exp
python dataprocess.pyMain DCT experiment:
python main2.pyThis corresponds to the ImageNet / ImageNet-V2 / ImageNet-R /
ImageNet-Sketch / ImageNet-A closeness comparison. The script expects the
precomputed feature files generated by dataprocess.py.
Directory:
DA_exp/
Script:
cd DA_exp
python main.pyThis is the ImageNet confidence-gap case study based on selected class groups.
Directory:
ADV_exp/
Typical workflow:
cd ADV_exp
python train_model.py
python adv_generator.py
python main.pymain.py assumes the adversarial feature artifacts have already been generated.