2017-07-14 51 views
0

私はbrnnパッケージを使用して、正規化ニューラルネットワークを自分のデータに合わせました。いくつかのケースでは、私はエラーを取得する:"システムは計算上単数型です" brnnパッケージ

Error in solve.default(2 * beta * H + ii(2 * alpha, npar)) : 
    system is computationally singular: reciprocal condition number = 2.29108e-20 

私はStackOverflowの上で、このトピックに関連するすべての問題を読みますが、解決策は私の問題に直接適用されません。これまでのところ、私は知っている:

  1. 問題がsolve()機能にrelys brnn()機能、です。解決策は、許容差(パッケージのtol引数)を減らすことです。私はそれを減らしましたが、問題は残っていました。
  2. 予測子の多共線性。私は独立変数を1つしか持たないので、これは不可能です。
  3. ここで私は.. brnn package

    エラーを再現するために使用することができ、私のコードの一部について

GitHubのサイト立ち往生午前: 1.データ

temporal_df = structure(list(x = c(-0.553333333333333, -3.56, -2.36333333333333, 
            1.48666666666667, 1.15, 0.636666666666667, -0.593333333333333, 
            -1.52, -2.56, -0.156666666666667, -1.09666666666667, 0.96, 0.02, 
            1.73333333333333, 0.34, 1.25666666666667, -0.396666666666667, 
            -1.15, 2.95, -1.95333333333333, -0.293333333333333, 4.33333333333333, 
            0.35, 1.41666666666667, 3.36666666666667, -1.54333333333333, 
            1.1, 0.32, 2.42, 0.34, -1.82333333333333, 1.88333333333333, 2.07666666666667, 
            1.96, 2.25333333333333, 0.303333333333333, 2.81333333333333, 
            -3.14, 0.776666666666667, 4.93, -2.16666666666667, 2.41333333333333, 
            2.23333333333333, 1.71666666666667, 0.623333333333333, 4.85666666666667, 
            0.436666666666667, 2.56333333333333, 2.21666666666667, 0.0133333333333334, 
            3.38333333333333, 1.51666666666667), MVA = c(7.1856694, 5.598461, 
                       5.872606, 6.5031284, 5.6605362, 6.002758, 6.018826, 7.3664676, 
                       5.7172694, 5.9872138, 6.07253916666667, 5.87814966666667, 5.132916, 
                       6.26116966666667, 5.7409835, 5.75330233333333, 5.93054783333333, 
                       5.52767016666667, 5.5299795, 5.8777515, 5.501568, 5.696386, 5.74542866666667, 
                       5.45688033333333, 5.14158866666667, 6.22877433333333, 6.39709566666667, 
                       6.82969366666667, 6.709905, 6.06170333333333, 6.11582483333333, 
                       6.20273833333333, 6.709709, 6.40844766666667, 6.15858716666667, 
                       5.9047125, 6.1760875, 6.86213666666667, 6.45906283333334, 7.02090133333333, 
                       6.467793, 6.47158383333333, 6.76265383333333, 6.10339883333333, 
                       7.23381633333333, 6.75162833333333, 6.59454716666667, 6.50917566666667, 
                       6.66505483333333, 7.58141116666667, 7.15875233333333, 7.742872 
            )), .Names = c("x", "MVA"), row.names = c(NA, -52L), class = "data.frame") 

を作成今すぐフィットbrnnモデル:

#install.packages('brnn')  
library(brnn) 
temporal_model <- brnn(x ~ ., data = temporal_df, neurons = 2, tol = 1e-30) 

最初に提案された解決策の後に編集: 可能な解決策の1つは、tol = 1e-6を設定することです。これは実際には問題の一部のみを保存します。私はまだ繰り返しの約1/3でエラーを取得します。したがって、私は何か他のものがあるはずだと信じています。

> temporal_model <- brnn(x ~ ., data = temporal_df, neurons = 2, tol = 1e-6) 
Number of parameters (weights and biases) to estimate: 6 
Nguyen-Widrow method 
Scaling factor= 1.4 
gamma= 0  alpha= 0 beta= 2.3753 

> temporal_model <- brnn(x ~ ., data = temporal_df, neurons = 2, tol = 1e-6) 
Number of parameters (weights and biases) to estimate: 6 
Nguyen-Widrow method 
Scaling factor= 1.4 
Error in solve.default(2 * beta * H + ii(2 * alpha, npar)) : 
    system is computationally singular: reciprocal condition number = 5.01465e-19 

> temporal_model <- brnn(x ~ ., data = temporal_df, neurons = 2, tol = 1e-6) 
Number of parameters (weights and biases) to estimate: 6 
Nguyen-Widrow method 
Scaling factor= 1.4 
gamma= 0  alpha= 0 beta= 2.3753 

> temporal_model <- brnn(x ~ ., data = temporal_df, neurons = 2, tol = 1e-6) 
Number of parameters (weights and biases) to estimate: 6 
Nguyen-Widrow method 
Scaling factor= 1.4 
gamma= 0  alpha= 0 beta= 2.3753 

> temporal_model <- brnn(x ~ ., data = temporal_df, neurons = 2, tol = 1e-6) 
Number of parameters (weights and biases) to estimate: 6 
Nguyen-Widrow method 
Scaling factor= 1.4 
gamma= 0  alpha= 0 beta= 2.3753 

> temporal_model <- brnn(x ~ ., data = temporal_df, neurons = 2, tol = 1e-6) 
Number of parameters (weights and biases) to estimate: 6 
Nguyen-Widrow method 
Scaling factor= 1.4 
Error in solve.default(2 * beta * H + ii(2 * alpha, npar)) : 
    system is computationally singular: reciprocal condition number = 7.24518e-19 

> temporal_model <- brnn(x ~ ., data = temporal_df, neurons = 2, tol = 1e-6) 
Number of parameters (weights and biases) to estimate: 6 
Nguyen-Widrow method 
Scaling factor= 1.4 
gamma= 0  alpha= 0 beta= 2.3753 

> temporal_model <- brnn(x ~ ., data = temporal_df, neurons = 2, tol = 1e-6) 
Number of parameters (weights and biases) to estimate: 6 
Nguyen-Widrow method 
Scaling factor= 1.4 
gamma= 0  alpha= 0 beta= 2.3753 

> temporal_model <- brnn(x ~ ., data = temporal_df, neurons = 2, tol = 1e-6) 
Number of parameters (weights and biases) to estimate: 6 
Nguyen-Widrow method 
Scaling factor= 1.4 
Error in solve.default(2 * beta * H + ii(2 * alpha, npar)) : 
    system is computationally singular: reciprocal condition number = 1.04673e-17 
+0

データに文字列や要素がありますか? – maller

+0

いいえ、2つの数値変数があります。 Y〜X.Yはすべての反復で固定され、Xは反復ごとに変化します。 XはrowMeanで計算されます。私は自分の質問を編集し、コードのサンプルを追加しました。 – JerryTheForester

+0

P.S:この質問をクロスバリデーションにコピーする方法はありますか? – JerryTheForester

答えて

1

数字1e-30は、1e-16の典型的な「本質的にゼロ数」と比べて少し小さいです。この数は、POSIX標準の8倍浮動小数点表現「倍精度」の精度の限界である2.2e-32の平方根に近いことに基づいて選択されます。 Rの達人がこのような小さな数字を使ったことは一度も見たことがありません。 CV.comのこの説明を参照してください:L-BFGS-Bを早期に停止させるにはどうしたらいいですか? https://stats.stackexchange.com/questions/126251/how-do-i-force-the-l-bfgs-b-to-not-stop-early-projected-gradient-is-zero

デフォルトの許容誤差が1E-6のままにされている場合brnnへの呼び出し(時々)がエラーなしで実行されますので、それも不要です。この方法は、擬似ランダムである、エラーなしで実行すると

> temporal_model <- brnn(x ~ ., data = temporal_df, neurons = 2, tol = 1e-6) 
Number of parameters (weights and biases) to estimate: 6 
Nguyen-Widrow method 
Scaling factor= 1.4 
gamma= 0  alpha= 0 beta= 2.3753 

実際には、データには構造がなく、予測は均一で、平均にかなり近いものです。

+0

ありがとう@ 42-。しかし、この問題は完全に解決されていません。コードを何度も繰り返すと、関数はエラーを返します。 (詳細については、私の編集した質問を参照してください)。しかし、わかりました。私は数学者から遠いですが、エラーを防ぐ手段はありますか? – JerryTheForester

+1

私は、計算上の特異なイベントのために投げられるエラーが少なくなるという、基本的にはヌルの関係ではなく、もう少し「トレンド」のデータを与えると思っています。 –

+0

真。ここではキャッチがあります:この関数は、可能なプレディクタを繰り返し、最適なものを見つけることを試みる、より大きな関数の一部です。ただし、一部の予測変数にはヌルの関係があります(例では問題の例)が、そうでなければエラーになります。 したがって、考えられる解決策はエラーを抑えることです。 – JerryTheForester

関連する問題