Learning with Signatures(实用性待验证)

537 阅读10分钟

本文已参与「新人创作礼」活动,一起开启掘金创作之路。

参考

Author

image.png

paper

2204.07953v1.pdf (arxiv.org)

code

decurtoydiaz/learning_with_signatures: Learning with Signatures (github.com)

Abstract

在这项工作中,我们研究了签名转换(Signature Transform)在学习中的应用。在这个假设下,我们提出了一个监督框架,该框架通过使用很少的标签(labels)来提供最先进的分类准确度,而不需要信用分配,并且最小或不过度拟合。我们通过使用签名(signature)和日志签名(log-signature)利用谐波分析(harmonic analysis)工具,并将RMSE和MAE签名和日志签名用作分数函数。我们建立了一个封闭式方程来计算可能很好的最佳比例因子。在CPU级别执行分类的速度比其他方法快几个数量级。我们在AFHQ数据集、四个形状、MNIST和CIFAR10上报告结果,所有任务的准确率均达到100%。

Introduction

  • 在上个世纪,为计算机提供学习能力一直是研究的核心。最近,通过使用深度学习的有监督和无监督技术已经成为所有学科中许多问题的最先进解决方案。基于模型的解决方案占主导地位的领域已迅速转向数据驱动的框架,并取得了前所未有的实证成功。然而,一些领域的进展停滞不前,因为此类模型的超参数数量多,难以解释,而且其鲁棒性缺乏收敛的理论保证。我们的目标是通过使用特征码变换[1-4]来研究一种新型的学习机制,这是一种最近从谐波分析中开发的工具,它提供了对不规则采样数据流的紧凑而丰富的描述。我们探讨了这样一个命题,即通过将数据转换成一个紧凑但完整的领域,我们可以通过使用很少的标记样本获得相同的深度学习经验收益。5.作为一个候选者,它是一个理想的时间不变性的表示,它是一个更普遍的特征。

  • 毕竟,人类不需要成千上万的例子来学习简单的概念,而需要从中选出极少数的例子来快速做出正确的猜测。通过签名学习可以达到这一目的,计算机可以迅速推断信息,因为其表示形式易于理解、丰富且完整。不过,需要一个分数函数,就像损失和学分分配给传统学习框架提供了将优化引导到可能很好的解决方案的能力一样。在签名的情况下,我们建议使用基于签名转换本身的相似性度量,即最近在[7]中开发的RMSE和MAE签名和日志签名。该框架在CPU上的工作速度比DL方法快几个数量级,并且避免了通常在GPU上完成的数以百万计的超参数的繁琐的信用分配,这需要高计算和环境成本。这些指标捕捉了详细的视觉线索,可用于内存占用非常小、执行速度快和精度高的分类任务。

  • 在这篇手稿中,我们将重点放在说明性示例上,以研究所提出的体系结构,并自下而上提出一个完整的学习框架。

Overview

  • 在将签名转换集成到学习框架[5,8,9]方面已经取得了进展,主要是作为ML范式中的特征提取器,或作为深层网络中的池层。作为构建学习问题的一种方式,签名的良好理论特性吸引了科学界的关注。不过,总体框架尚未建立。这主要是因为没有一个正确定义的分数函数来指导学习机制。[7]中最近的工作建议使用RMSE和MAE签名以及对数签名来评估图像分布之间的视觉相似性,以确定GAN收敛性。尽管从另一个角度来看问题,RMSE和MAE签名和日志签名确实是正确定义的分数函数,可以用于分类和聚类。在这种假设下,本研究的目的是进一步研究这种学习框架的行为、性质及其在多个任务上的泛化能力。
  • 学分分配,例如反向传播,一直是现代自动学习技术的基本组成部分;然而,仅在一次过程中(即使用一个历元)从数据中提取所有重要信息在理论上是可行的。事实上,使用多个训练数据的必要性可能是由于所使用的学习机制的限制,而不是优势。给定适当的分数函数,签名提供了一种紧凑的表示形式,计算机可以使用它来推断细粒度信息,而无需使用反向传播,从而避免优化数百万个超参数。与其他训练机制相比,这种特性使带特征的学习具有计算优势,因为标记示例的数量可以大幅减少,并且训练被元素平均值所取代,这赋予了良好泛化所需的统计稳健性。

Signature Transform and Harmonic Analysis

  • 在[5]之后,the path x的N阶截断签名被定义为坐标迭代积分的集合 SN(x)=((0<t1<<ta<1c=1adfzc(tc)dt1dta dt)1z1,,zad)1aN\mathrm{S}^{N}(\mathbf{x})=\left(\left(\int_{0<t_{1}<\cdots<t_{a}<1} \cdots \prod_{c=1}^{a} \frac{\mathrm{d} f_{z_{c}}\left(t_{c}\right) \mathrm{d} t_{1} \cdots \mathrm{d} t_{a}}{\mathrm{~d} t}\right)_{1 \leq z_{1}, \ldots, z_{a} \leq d}\right)_{1 \leq a \leq N} -----(1)

这个就看成是signature特征提取公式吧

  • 如[7]所述,签名是从paths的幺半群(monoid:独异点)到封闭张量代数(closed tensor algebra)的类群元素(grouplike elements)(方程式2)的同态(homomorphism)。它提供了path x的分级摘要。一个path的提取特征位于a rough path定义的中心[1];它们消除了考虑path内部详细结构的必要性。对特征提取公式的解释 S:{fFf:[x,y]E=Rd}T(E)=T(Rd)=c=0(Rd)c\mathrm{S}:\left\{f \in F \mid f:[x, y] \rightarrow E=\mathbb{R}^{d}\right\} \longrightarrow T(E)=T\left(\mathbb{R}^{d}\right)=\prod_{c=0}^{\infty}\left(\mathbb{R}^{d}\right)^{\otimes c} --------------(2)

根据前面的定义,我们可以提出RMSE和MAE签名以及log签名作为分数函数,以继承[7]中的相似性度量。

Definition 1 给定一组N阶截断签名,{ScN(xc)}c=1m\left\{\mathrm{S}_{c}^{N}\left(\mathbf{x}_{c}\right)\right\}_{c=1}^{m} the element-wise mean is defined by

S~N(x(z))=1mc=1m ScN(xc(z))\tilde{\mathrm{S}}^{N}\left(x^{(z)}\right)=\frac{1}{m} \sum_{c=1}^{m} \mathrm{~S}_{c}^{N}\left(x_{c}^{(z)}\right)

where z{1,,n}z \in\{1, \ldots, n\} is the specific component index of the given signature.

然后RMSE和MAE签名可以定义如下:

Definition 2. Given nn components of the element-wise mean of the signatures {y(c)}c=1nT(Rd)\left\{y^{(c)}\right\}_{c=1}^{n} \subseteq T\left(\mathbb{R}^{d}\right) from the corresponding class of the train data and the same number of components of the signature of the given (optional element-wise mean augmented) test instance to score {x(c)}c=1nT(Rd)\left\{x^{(c)}\right\}_{c=1}^{n} \subseteq T\left(\mathbb{R}^{d}\right), then we define the Root Mean Squared Error (RMSE) and Mean Absolute Error (MAE) by

RMSE({x(c)}c=1n,{y(c)}c=1n)=1nc=1n(y(c)x(c))2\operatorname{RMSE}\left(\left\{x^{(c)}\right\}_{c=1}^{n},\left\{y^{(c)}\right\}_{c=1}^{n}\right)=\sqrt{\frac{1}{n} \sum_{c=1}^{n}\left(y^{(c)}-x^{(c)}\right)^{2}}

and

MAE({x(c)}c=1n,{y(c)}c=1n)=1nc=1ny(c)x(c)\operatorname{MAE}\left(\left\{x^{(c)}\right\}_{c=1}^{n},\left\{y^{(c)}\right\}_{c=1}^{n}\right)=\frac{1}{n} \sum_{c=1}^{n}\left|y^{(c)}-x^{(c)}\right|
  • 日志签名的情况与此类似。可以在测试实例上执行增强(例如对比度和亮度的随机变化),以创建多样性,从而可以在元素均值之间进行比较,并且结果呈现统计稳健性。

  • RMSE和MAE签名和日志签名,以评估[7]在灰度输入数据工作中介绍的GAN收敛性。我们在不损失RGB样本通用性的情况下扩展了定义,因为在分类和聚类的背景下,使用颜色通道可以提供有用的信息和更好的准确性(以牺牲更多计算和内存开销为代价)。

Few-shot Classification using Signatures

  • 通过使用特征码(signatures)和定义的得分函数,将每个test samples(在可选的元素平均值(element-wise mean)计算和增强(augmentation)之后)与通过对给定数量的train samples的特征码(signatures)求平均值计算出的代表性元素平均值特征码进行比较,可以获得Few-shot classification of samples。实现更高分类精度所需的最小签名数可能取决于要完成的任务的复杂性,有些类别可能只需要一个代表,而其他更具可变性的类别则需要数万到数千个训练样本。

  • 分类定义可以很好的解释于,对于元素平均类代表(representative)和元素平均增强测试样本,达到了一个比例因子。充分的乘法因子可以通过验证集上的网格搜索或使用更复杂的方法(例如k-fold交叉验证或贝叶斯分析)贪心法确定。这些比例因子可以是简单的乘法常数,也可以是对图像数据进行操作的注意遮罩。定义4提出了一个简单的程序来确定一个可能很好的最优解λ∧∗. 实证实验表明,这些比例因子或注意口罩一旦在验证集上进行调整,就可以在测试集中进行最小或没有过度拟合的概括。因此,证实了最初的假设,即通过使用适当的学习框架可以避免学分分配。

Definition 3. Few-shot Classification. Given nn components of the element-wise mean of the signatures or log-signatures {y(c)}c=1nT(Rd)\left\{y^{(c)}\right\}_{c=1}^{n} \subseteq T\left(\mathbb{R}^{d}\right) from the corresponding class of the train data and the same number of components of the signature or log-signature of the given (optional element-wise mean augmented) test instance to score {x(c)}c=1nT(Rd)\left\{x^{(c)}\right\}_{c=1}^{n} \subseteq T\left(\mathbb{R}^{d}\right), then we can assign a predicted class instance by using the Root Mean Squared Error (RMSE) and Mean Absolute Error (MAE) by choosing the minimum RMSE and MAE of the corresponding categories as

RMSE(λa{x(c)}c=1n,λb{y(c)}c=1n)\operatorname{RMSE}\left(\lambda_{a} \odot\left\{x^{(c)}\right\}_{c=1}^{n}, \lambda_{b} \odot\left\{y^{(c)}\right\}_{c=1}^{n}\right)

and

MAE(λc{x(c)}c=1n,λd{y(c)}c=1n)\operatorname{MAE}\left(\lambda_{c} \odot\left\{x^{(c)}\right\}_{c=1}^{n}, \lambda_{d} \odot\left\{y^{(c)}\right\}_{c=1}^{n}\right)

上面的公式就是计算由train和val集得出的signature特征和计算test图片得到的signature特征之间的均方误差或平均绝对误差。 关键是λ\lambda_{*}的确定, 代码中是由train set 中每一个类别抽取10个样本然后计算10个样本中平均signature特征【supermeanA[]】。之后计算val set中的所有类别10个样本的平均signature特征【featuresAA】,之后, 使用supermeanA[c类]抽取相似特征乘以featuresAA作为最终的每个类别supermean_i。 但是在测试的时候,使用的却是supermean_i[c类别] * supermeanA[c类别]就很疑惑, 将supermeanA[c类别]看作λ\lambda_{*}????

where λ\lambda_{*} are adequate multiplicative factors or tensor masks tuned on the validation set.

Definition 4. Let λRn\lambda_{*} \in \mathbb{R}^{n} be the optimal solution of the following inverse problem, Definition 3 , and nn is the number of components of the corresponding signature or log-signature

λ{x(c)}c=1n={y(c)}c=1n\lambda_{*} \odot\left\{x^{(c)}\right\}_{c=1}^{n}=\left\{y^{(c)}\right\}_{c=1}^{n}

we can determine a probably good solution λ~\tilde{\lambda_{*}} by inverting the element-wise mean of the signatures or log-signatures from the corresponding class of the train data multiplied by each corresponding signature or log-signature of the (optional element-wise mean augmented) validation instances and averaging to get a pondered scale factor.

我们可以确定一个可能很好的解λ~\tilde{\lambda_{*}}通过将相应类别的train数据中的signature或log-signaturede 元素平均值乘以(可选元素平均值增强)验证实例的每个对应特征码或对数特征码,并求平均值,得到一个考虑过的比例因子。

看到这这个idea感觉有点问题, 它使用了(已知类别的特征*other作为比例因子, 然而, 我们在测试图片的时候, 图片是没有已知类别的先验条件。)

后面我先不看了

The reason behind the need to introduce a set of hyperparameters comes from the property of the uniqueness of the signature [10, 5].

Proposition 1 (Uniqueness of signature [10]). Let X:[a,b]RdX:[a, b] \rightarrow \mathbb{R}^{d} be a continuous piecewise smooth path. Then S(X^)\mathrm{S}(\widehat{X}) uniquely determines XX up to translation.

The work of [10] already explored the relationship between a path and its signature. They determine a precise geometric relation \sim on bounded variation paths, and prove that two paths of finite length are \sim-equivalent if and only if they have the same signature:

XCYAXC=YA.\left.\left.X\right|_{C} \sim Y\right|_{A} \Longleftrightarrow \mathbf{X}_{C}=\mathbf{Y}_{A} .

Indeed, [11] brought forward precursors to these ideas and formulated the uniqueness of S(X^)\mathrm{S}(\widehat{X}) up to translation, Proposition 1. This property, Theorem 1, implies that for best comparison of signatures adequate cropping fairly benefits the performance of RMSE and MAE Signature and log-signature.

Theorem 1([11])1([11]). Let dγ1,,dγdd \gamma_{1}, \cdots, d \gamma_{d} be the canonical 1 -forms on Rd\mathbb{R}^{d}. If α,β[a,b]Rd\alpha, \beta \in[a, b] \rightarrow \mathbb{R}^{d} are irreducible piecewise regular continuous paths, then the iterated integrals of the vector valued paths α(0)α(t)dγ\int_{\alpha(0)}^{\alpha(t)} d \gamma and β(0)β(t)dγ\int_{\beta(0)}^{\beta(t)} d \gamma agree if and only if there exists a translation T\mathrm{T} of Rd\mathbb{R}^{d}, and a continuous increasing change of parameter λ:[a,b][a,b]\lambda:[a, b] \rightarrow[a, b] such that α=Tβλ\alpha=T \beta \lambda.

For evaluation and testing of these ideas we use the standard AFHQ dataset [12] that consists on images of classes 'cat', 'dog' and 'wild'. We observe perfect classification accuracy in a difficult task without the need of credit assignment given the adequate number of signatures and the appropriate choice of hyperparameters λ\lambda_{*}. RMSE Signature is used as score function. We use 100 samples per class from the subset of training to compute an element-wise mean representative of each category and compare against test instances (with no augmentation) using a truncated signature of order 2 , image size 16×1616 \times 16 and RGB color samples. We use a subset of validation of 500 samples per class from the AFQH training subset and compute optimal λ\lambda_{*} according to Definition 4 , obtaining perfect performance on the validation set. We then compute test scores using the AFHQ 500 validation per class samples and achieve 100%100 \% accuracy.