pinv(H)不等于pinv(H'* H)* H'

时间:2019-02-14 19:45:29

标签: matlab neural-network

我正在使用具有20个神经元的单隐藏层前馈神经网络(SLFN)测试y = SinC(x)函数。

对于SLFN,在输出层中,输出权重(OW)可以用

描述
OW = pinv(H)*T

添加正则化参数gamma

之后
OW = pinv(I/gamma+H'*H)*H'*T 

gamma -> Inf, pinv(H'*H)*H'*T == pinv(H)*T, also pinv(H'*H)*H' == pinv(H).

但是当我尝试计算pinv(H'*H)*H'pinv(H)时,当神经元数量超过5(低于5,它们相等或几乎相同)时,我发现两者之间存在巨大差异。

例如,当H10*10矩阵时,cond(H) = 21137561386980.3rank(H) = 10

H = [0.736251410036783  0.499731137079796   0.450233920602169   0.296610970576716   0.369359425954153   0.505556211442208   0.502934880027889   0.364904559142718   0.253349959726753   0.298697900877265;
0.724064281864009   0.521667364351399   0.435944895257239   0.337878535128756   0.364906002569385   0.496504064726699   0.492798607017131   0.390656915261343   0.289981152837390   0.307212326718916;
0.711534656474153   0.543520341487420   0.421761457948049   0.381771374416867   0.360475582262355   0.487454209236671   0.482668250979627   0.417033287703137   0.329570921359082   0.315860145366824;
0.698672860220896   0.565207057974387   0.407705930918082   0.427683127210120   0.356068794706095   0.478412571446765   0.472552121296395   0.443893207685379   0.371735862991355   0.324637323886021;
0.685491077062637   0.586647027111176   0.393799811411985   0.474875155650945   0.351686254239637   0.469385056318048   0.462458480695760   0.471085139463084   0.415948455902421   0.333539494486324;
0.672003357663056   0.607763454504209   0.380063647372632   0.522520267708374   0.347328559602877   0.460377531907542   0.452395518357816   0.498449772544129   0.461556360076788   0.342561958147251;
0.658225608290477   0.628484290731116   0.366516925684188   0.569759064961507   0.342996293691614   0.451395814182317   0.442371323528726   0.525823695636816   0.507817005881821   0.351699689941632;
0.644175558300583   0.648743139215935   0.353177974096445   0.615761051907079   0.338690023332811   0.442445652121229   0.432393859824045   0.553043275759248   0.553944175102542   0.360947346089454;
0.629872705346690   0.668479997764613   0.340063877672496   0.659781468051379   0.334410299080102   0.433532713184646   0.422470940392161   0.579948548513999   0.599160649563718   0.370299272759337;
0.615338237874436   0.687641820315375   0.327190410302607   0.701205860709835   0.330157655029498   0.424662569229062   0.412610204098877   0.606386924575225   0.642749594844498   0.379749516620049];

T=[-0.806458764562879 -0.251682808380338 -0.834815868451399 -0.750626822371170 0.877733363571576 1 -0.626938984683970 -0.767558933097629 -0.921811074815239 -1]';

pinv(H'*H)*H*Tpinv(H)*T之间存在巨大差异,其中

pinv(H'*H)*H*T = [-4803.39093243484   3567.08623820149    668.037919243849  5975.10699147077  
                   1709.31211566970  -1328.53407325092  -1844.57938928594 -22511.9388736373  
                  -2377.63048959478  31688.5125271114]';

pinv(H)*T = [-19780274164.6438 -3619388884.32672 -76363206688.3469 16455234.9229156
             -135982025652.153 -93890161354.8417 283696409214.039 193801203.735488
             -18829106.6110445 19064848675.0189]'.

我还发现,如果我四舍五入Hround(H,2)pinv(H'*H)*H*Tpinv(H)*T会返回相同的答案。所以我想原因之一可能是matlab内部的float计算问题。

但是由于cond(H)很大,因此H的任何细微变化都可能导致H的倒数相差很大。我认为round函数可能不是测试的好选择。正如克里斯·伦戈(Cris Luengo)所提到的,cond较大时,数值不精确度将影响逆的精度。

在测试中,我使用了1000个训练样本Input:[-10,10],且噪声在[-0.2,0.2]之间,并且测试样本没有噪声。选择了20个神经元。 OW = pinv(H)*T可以为SinC训练提供合理的结果,而OW = pinv(H'*H)*T的表现则较差。然后,我尝试将H'*H的精度提高pinv(vpa(H'*H)),没有明显的改善。

有人知道如何解决吗?

1 个答案:

答案 0 :(得分:1)

经过一些研究,答案是ELM对缩放和激活功能非常敏感。

有关详细信息,请参阅本文:https://dl.acm.org/citation.cfm?id=2797143.2797161

论文:https://ieeexplore.ieee.org/document/8533625展示了一种noval算法,可以提高ELM的缩放性能。