0

Java でのロジスティック回帰の関数最小化のために、RISO の L-BFGS ライブラリの実装をテストしています。ここに私が使用しているクラスへのリンクがあります。

ライブラリをテストするために、関数を最小化しようとしています:

f(x) = 2*(x1^2) + 4*x2 + 5

ライブラリには、以下のように実装した目的関数と勾配関数が必要です。

   /**
      The value of the objective function, given variable assignments
      x. This is specific to your problem, so you must override it.
      Remember that LBFGS only minimizes, so lower is better.
   **/
   public double objectiveFunction(double[] x) throws Exception {
        return (2*x[0]*x[0] + 3*x[1] + 1);
   }

   /**
      The gradient of the objective function, given variable assignments
      x.  This is specific to your problem, so you must override it.
   **/
   public double[] evaluateGradient(double[] x) throws Exception {
        double[] result = new double[x.length];
        result[0] = 4 * x[0];
        result[1] = 3;
        return result;
   }

この目的関数と勾配の実装でコードを実行すると、次の例外が発生します。

Exception in thread "main" Line search failed. See documentation of routine mcsrch. 
Error return of line search: info = 3 Possible causes: 
function or gradient are incorrect, or incorrect tolerances. (iflag == -1)

公差をデフォルト値から変更していません。私は何を間違っていますか?

4

1 に答える 1