IZEL_set_loss_function

損失関数を指定します。

int  IZEL_set_loss_function(int handle, int loss_function)

引数

  引数名

I/O                説明
handle In ハンドラ値
loss_function In

損失関数を指定します。以下の損失関数を指定できます。

この関数が呼ばれなかった時は、デフォルト値はクロスエントロピーとして学習を実施します。

   E_LOSS_FUNC_CROSS_ENTROPY : クロスエントロピー

   E_LOSS_MEAN_SQUARED_ERROR  : 最小二乗誤差 

戻り値

0 : 正常

-1: エラー

サンプルソース

#include <Izel.mqh>

void sample()
{
   int handle;

   //   オープン
   handle = IZEL_open();

   if( handle < 0 ) {
      // エラー処理;
   }

   // 学習モデルの定義 
   IZEL_add_layer(handle, 100);
   IZEL_add_layer(handle, 200);
   IZEL_set_output_layer(handle, 2);
   IZEL_set_loss_function(handle, E_LOSS_MEAN_SQUARED_ERROR);
   // トレーニングデータのセット
   IZEL_open_x_train(handle);
   IZEL_append_x_train(handle, 1.0);
   IZEL_append_x_train(handle, 2.0);
   IZEL_close_x_train(handle);
   IZEL_set_y_train(handle, 1);

   /*
      データのセットを繰り返す。
      ・
  ・
  ・
 */
   // トレーニング
   IZEL_fit(handle, 100, 32);
   

   // クローズ
   IZEL_close(handle);
}

Copyright (C) izel.cloud-line.com All Rights Reserved.