Keras : 目的関数(翻訳/要約)
* 本ページは、Keras 本家サイトの Keras : Objectives の簡単な要約です。
目的関数の使用方法
目的関数(あるいは損失関数、あるいは最適化スコア (optimization score) 関数)はモデルを compile するに必要な2つのパラメータの一つです :
model.compile(loss='mean_squared_error', optimizer='sgd')
既存の目的関数の名前を渡すこともできるし、あるいは、次の2つの引数を取り各データポイントのためのスカラを返す、 Theano/TensorFlow シンボリック関数を渡すこともできます :
- y_true: True ラベル。Theano/TensorFlow テンソル。
- y_pred: 予測。y_true と同じ shape の Theano/TensorFlow テンソル。
実際の最適化された目的関数 (optimized objective) は全てのデータポイントに渡る出力配列の平均です。
そのような関数の2、3の例は、objectives source を check out してください。
利用可能な目的関数 (objectives)
- mean_squared_error / mse
- mean_absolute_error / mae
- mean_absolute_percentage_error / mape
- mean_squared_logarithmic_error / msle
- squared_hinge
- hinge
- binary_crossentropy: logloss としても知られます。
- categorical_crossentropy: Also known as multiclass logloss としても知られます。Note: この目的関数を使用するためには、ラベルが arrays of shape (nb_samples, nb_classes) であることが必要です。
- poisson: (予測 – targets * log(予測)) の平均。
- cosine_proximity: the opposite (negative) of the mean cosine proximity between predictions and targets.
以上