基本上,这里的所有部分都可以在线性代数书中找到。但是,格拉姆-施密特正交化被用于统计算法和解决统计问题。因此,我们将简要介绍理解格拉姆-施密特正交化所需的线性代数理论。
以下子节也包含示例。对于进一步理解,重要的是这里介绍的概念不仅适用于作为实数元组的典型向量,也适用于可以被视为向量的函数。
一个集合
,在其元素上具有两个运算
和
,被称为域(或简写为
),如果满足以下条件
- 对于所有
,有 
- 对于所有
,有
(交换律)
- 对于所有
,有
(结合律)
- 存在一个独特的元素
,称为 *零*,使得对于所有
都有 
- 对于所有
,存在一个唯一的元素
,使得 
- 对于所有
都有 
- 对于所有
都有
(交换律)
- 对于所有
都有
(结合律)
- 存在一个唯一的元素
,称为 *一*,使得对于所有
都有 
- 对于所有非零
,存在一个唯一的元素
,使得 
- 对于所有
都有
(分配律)
中的元素也被称为 *标量*。
很容易证明,具有众所周知的加法和乘法的实数
是一个域。对于具有加法和乘法的复数,情况也是如此。实际上,很少有其他集合可以满足所有这些条件。
对于统计学,只有实数和复数与加法和乘法很重要。
具有两个运算
和
的集合
称为在 R 上的向量空间,如果满足以下条件:
- 对于所有
满足 
- 对于所有
满足
(交换律)
- 对于所有
满足
(结合律)
- 存在一个唯一的元素
,称为原点,使得对于所有
满足 
- 对于所有
存在一个唯一的元素
,使得满足 
- 对于所有
和
满足 
- 对于所有
和
都满足
(结合律)
- 对于所有
和
都满足 
- 对于所有
和所有
都满足
(对向量加法的分配律)
- 对于所有
和所有
都满足
(对标量加法的分配律)
注意,我们在
和
中使用了相同的符号
和
来表示不同的运算。
的元素也被称为 _向量_。
示例
- 集合
,其中包含实值向量
,并定义了逐元素加法
和逐元素乘法
,是一个关于
的向量空间。
- 度数为
的多项式集合
,其中定义了通常的加法和乘法,是一个关于
的向量空间。
如果向量
可以表示为向量
的线性组合,则
其中
。
示例
是
的线性组合,因为 
是
的线性组合,因为 
一组向量
称为向量空间
的基,如果
1. 对于每个向量
存在标量
使得
2.
的任何子集都不能满足条件 1。
需要注意的是,一个向量空间可以有多个基。
示例
- 每个向量
可以写成
。因此,
是
的一个基。
- 每个
次多项式可以写成
的线性组合,因此构成该向量空间的基。
事实上,对于这两个例子,我们都需要证明条件 2,但很明显它成立。
向量空间的维数是指构成基所需要的向量的个数。向量空间有无穷多个基,但维数是唯一确定的。请注意,向量空间可能具有无穷维,例如考虑连续函数空间。
示例
的维数是 3,
的维数是
。
次多项式的维数是
。
映射
称为标量积,如果对于所有
和
以下成立:


,其中 
,其中
示例
- 在
中,典型的标量积是
。
是度数为
的多项式向量空间上的标量积。
向量的 *范数* 是一个映射
,如果满足以下条件:
对于所有
以及
(正定性)
对于所有
以及所有 
对于所有
(三角不等式)
示例
- 在
中,向量的
范数定义为
.
- 每个标量积通过
生成一个范数,因此
是
次多项式的范数。
如果
,则称两个向量
和
彼此正交。在
中,两个向量之间的夹角的余弦可以表示为
.
如果
和
之间的夹角为 90 度(正交),则余弦为零,因此
.
如果向量集
满足
,则称此向量集为标准正交向量集。.
如果我们考虑一个向量空间的基底
,那么我们希望有一个正交归一基。为什么呢?
由于我们有一个基底,每个向量
和
可以表示为
和
。因此,
和
的标量积简化为
|
|
|
|
|
|
|
|
因此,如果系数已知,标量积的计算就简化为简单的乘法和加法。请记住,对于我们的多项式,我们需要解一个积分!
格拉姆-施密特正交化的目标是,对于一组向量
,找到一组等效的 *标准正交* 向量
,使得任何可以用
的线性组合表示的向量,也可以用
的线性组合表示。
1. 设置
以及
。
2. 对于每个
,设置
以及
。在每一步中,向量
投影到
上,并将结果从
中减去。
考虑区间
上的二次多项式,其标量积为
,范数为
。我们知道
和
是这个向量空间的一组基。现在让我们构造一个正交归一基。
步骤 1a:
步骤 1b:
步骤 2a:
步骤 2b:
步骤 3a:
步骤 3b:
可以证明
和
构成上述内积和范数下的正交规范基。
考虑向量
和
。假设
足够小,以至于在计算机上计算
成立(参见 http://en.wikipedia.org/wiki/Machine_epsilon)。让我们计算在
中,这些向量使用标准内积
和范数
的正交规范基。
步骤 1a. 
步骤 1b.
,其中 
步骤 2a. 
步骤 2b. 
步骤 3a. 
步骤 3b. 
很明显,对于向量
- 
- 
- 
标量积
. 其他所有对也不为零,但它们乘以
,因此结果接近于零。
为了解决这个问题,使用修正的 Gram-Schmidt 算法。
- 设置
对于所有 
- 对于每个
从
到
,计算
- 对于每个
从
到
计算 
不同之处在于,我们首先计算新的
并将其从所有其他
中减去。我们将错误计算的向量应用于所有向量,而不是分别计算每个
。
步骤 1.
,
, 
步骤 2a.
,其中 
步骤 2b. 
步骤 2c. 
步骤 3a. 
步骤 3b. 
步骤 4a. 
我们可以很容易地验证
.
在高维数据分析中,我们通常分析数据的投影。这种方法源于 Cramer-Wold 定理,该定理指出,如果我们知道所有一维投影,则多维分布是固定的。另一个定理指出,即使数据的多元分布高度非正态,多元数据的多数(一维)投影也看起来是正态的。
因此,在探索性投影追踪中,我们通过与(标准)正态分布的比较来判断投影的有趣性。如果我们假设一维数据
是标准正态分布的,那么在进行变换
后,其中
是标准正态分布的累积分布函数,那么
在区间
中均匀分布。
因此,有趣的程度可以通过
来衡量,其中
是根据数据估计的密度。如果密度
在区间
中等于
,则积分变为零,我们发现我们投影的数据服从正态分布。大于零的值表示投影数据的正态分布存在偏差,并且有希望是一个有趣的分布。
令
是一个具有内积
和范数
的正交多项式集。关于区间
中的密度
,我们可以得出什么结论?
如果
对于某个最大度数
成立,则有
我们也可以写成
或根据经验,我们得到一个估计量
.
我们描述术语
并为我们的积分得到
因此,使用正交函数集允许我们将积分简化为系数的求和,可以通过将
代入上述公式来从数据中估计。系数
可以提前预先计算。
剩下的唯一问题是找到正交多项式集
到达度数
。我们知道
为此空间形成一个基底。我们必须应用 Gram-Schmidt 正交化来找到正交多项式。这在 第一个示例 中已经开始。
得到的多项式称为归一化勒让德多项式。除一个缩放因子外,归一化勒让德多项式与 勒让德多项式 相同。勒让德多项式具有以下形式的递归表达式
因此,计算我们的积分就简化为计算
和
,并使用递归关系计算
。请注意,递归可能在数值上不稳定!
- Halmos, P.R. (1974). 有限维向量空间,施普林格:纽约