MI Benchmark Suite
收藏资源简介:
MI Benchmark Suite是由LG AI Research和首尔国立大学共同创建的综合基准套件,旨在评估神经互信息估计器在非结构化数据集上的表现。该数据集包括多元高斯数据集、图像数据集(如MNIST)和句子嵌入数据集(如IMDB电影评论数据集的BERT嵌入)。通过同类别采样和二进制对称通道技巧,数据集能够精确操纵真实的互信息值,从而为神经互信息估计器提供了一个全面的评估平台。该数据集的应用领域主要集中在深度学习中的互信息估计,旨在解决复杂数据集上的依赖性量化问题。
The MI Benchmark Suite is a comprehensive benchmark suite jointly developed by LG AI Research and Seoul National University, intended to evaluate the performance of neural mutual information estimators on unstructured datasets. The suite comprises three categories of datasets: multivariate Gaussian datasets, image datasets (e.g., MNIST), and sentence embedding datasets, such as BERT embeddings derived from the IMDB movie review dataset. By leveraging class-wise sampling and binary symmetric channel techniques, the suite allows for precise control over ground-truth mutual information values, thereby offering a holistic evaluation platform for neural mutual information estimators. Its primary application scenarios center on mutual information estimation in deep learning, with the goal of addressing dependency quantification issues on complex datasets.
数据集描述
概述
我们引入了一个全面的基准套件,用于评估神经互信息(MI)估计器在非结构化数据集上的表现,特别是图像和文本数据。通过利用同类别采样进行正配对,并引入二进制对称通道技巧,我们展示了可以准确操纵真实世界数据集的真实MI值。
数据集描述
我们提出了一个综合方法,用于在各种数据领域评估神经MI估计器。具体来说,该基准套件关注三种类型的数据领域:
1. 多元高斯数据集 (libs/utils_gaussian.py)
- 该数据集从多元高斯分布实时采样。
2. 图像数据集 (libs/utils_images.py)
- 当前版本中,有三种类型的图像数据集可用:MNIST、CIFAR-10 和 CIFAR-100。
- 我们的方法允许信息源为二进制随机变量(以利用位级MI值)。例如,在MNIST数据集中,我们使用类别0和1,共10,000个样本。
- 可以通过代码自由定义
n_patch、img_size和eta来控制信息源数量、表示维度和干扰强度。
3. 句子嵌入数据集 (libs/utils_text.py)
- 与图像数据集类似,我们的方法允许信息源为二进制随机变量(以利用位级MI值)。我们在
dataset目录中提供了类别0和1的数据集。 - 数据集从有限数量的样本中采样,每个类别有12,500个样本。每个样本以
.npy格式保存。
4. 图像和句子嵌入混合数据集 (libs/utils_mixture.py)
- 为了利用图像和句子嵌入的混合,我们根据预定义的类别信息从图像和句子嵌入中采样
x和y。
实验
我们提供了main.py中的实现代码。以下是每个参数的描述:
gpu_id: 用于训练的GPU索引(数据类型:int)savepath: 保存结果的路径(数据类型:str)ds: 信息源数量(数据类型:int)dr: 表示维度(数据类型:int)dtype: 数据类型(选项:gaussian, image, text, mixture)dname1: 图像数据集名称(如果不使用图像数据集,忽略此参数)(选项:mnist, cifar10, cifar100)dname2: 文本数据集名称(如果不使用文本数据集,忽略此参数)(选项:imdb.bert-imdb-finetuned, imdb.roberta-imdb-finetuned)nuisance: 干扰强度(仅适用于图像数据集)(数据类型:float)output_scale: MI值尺度(选项:bit, nat)critic_type: 批评函数$f(x,y)$的选择(选项:inner, bilinear, separable, joint)critic_depth: MLP批评的深度(数据类型:int)critic_width: MLP批评的宽度(数据类型:int)critic_embed: MLP批评的嵌入大小(数据类型:int)estimator: 神经MI估计器类型(选项:nwj, js, infonce, dv, mine, smile-1, smile-5, smile-inf)gaussian_cubic: 对于多元高斯数据集,设置为1以使用$y^3$而不是$y$。否则,设置为0(数据类型:int)image_patches: 对于图像数据集,定义组合模式为[channel, width, height](数据类型:str)image_channels: 图像数据集的图像通道数,即RGB或灰度(数据类型:int)encoder: 用于估计图像和文本深度表示之间MI的选项(选项:None, irevnet, realnvp, maf, pretrained_resnet)batch_size: 用于训练批评者的批量大小(数据类型:int)learning_rate: 用于训练批评者的学习率(数据类型:float)n_steps: 用于训练批评者的步数(数据类型:int)mode: 设置真实MI值的模式(选项:stepwise, single)true_mi: 用于估计的真实MI值(如果设置mode为stepwise,忽略此参数)(数据类型:float)
默认设置
critic_type: jointcritic_depth: 2critic_width: 256critic_embed: 32batch_size: 64learning_rate: 0.0005n_steps: 20000
示例
以下是简单的示例步骤:
-
克隆仓库: sh git clone https://github.com/kyungeun.lee/mibenchmark.git
-
导航到项目目录: sh cd mibenchmark
-
安装依赖: sh pip install -r requirements.txt
-
估计MI:
-
多元高斯示例: sh python main.py --gpu_id 0 --savepath results/gaussian --ds 10 --dr 10 --dtype gaussian --critic_type joint --estimator dv --mode stepwise
-
图像示例: sh python main.py --gpu_id 0 --savepath results/images --ds 10 --dr 4096 --dtype image --critic_type joint --estimator dv --mode stepwise --dname1 mnist --image_patches "[1, 2, 5]" --image_channels 1
-
句子嵌入示例: sh python main.py --gpu_id 0 --savepath results/texts --ds 10 --dr 7680 --dtype text --critic_type joint --estimator dv --mode stepwise --dname2 imdb.bert-imdb-finetuned
-
结果
- 估计日志保存到预定的
savepath中的mis.npy文件。 - 论文中使用的估计结果可在
results/*中找到。
- 分析估计结果:参见
result_analysis.ipynb中的示例。

- 1A Benchmark Suite for Evaluating Neural Mutual Information Estimators on Unstructured DatasetsLG AI Research · 2024年



