MeanAbsolutePercentageError

パブリック クラスMeanAbsolutePercentageError

ラベルと予測の間の平均絶対パーセント誤差を計算します。

loss = 100 * abs(labels - predictions) / labels

スタンドアロン使用:

    Operand<TFloat32> labels =
        tf.constant(new float[][] { {2.f, 1.f}, {2.f, 3.f} });
    Operand<TFloat32> predictions =
        tf.constant(new float[][] { {1.f, 1.f}, {1.f, 0.f} });
    MeanAbsolutePercentageError mape = new MeanAbsolutePercentageError(tf);
    Operand<TFloat32> result = mape.call(labels, predictions);
    // produces 50f
 

サンプルの重みを指定して呼び出します:

    Operand<TFloat32> sampleWeight = tf.constant(new float[] {0.7f, 0.3f});
    Operand<TFloat32> result = mape.call(labels, predictions, sampleWeight);
    // produces 20f
 

SUMリダクションタイプの使用:

    MeanAbsolutePercentageError mape = new MeanAbsolutePercentageError(tf, Reduction.SUM);
    Operand<TFloat32> result = mape.call(labels, predictions);
    // produces 100.0f
 

NONE削減タイプを使用する:

    MeanAbsolutePercentageError mape = new MeanAbsolutePercentageError(tf, Reduction.NONE);
    Operand<TFloat32> result = mape.call(labels, predictions);
    // produces [25f, 75f]
 

継承されたフィールド

パブリックコンストラクター

MeanAbsolutePercentageError (Ops tf)
getSimpleName()を損失名として使用し、損失削減としてREDUCTION_DEFAULTを使用して MeanAbsolutePercentageError Loss を作成します。
MeanAbsolutePercentageError (Ops tf、 Reduction削減)
getSimpleName()を損失名として使用して MeanAbsolutePercentageError Loss を作成します
MeanAbsolutePercentageError (Ops tf、文字列名、 Reduction削減)
MeanAbsolutePercentageError を作成します

パブリックメソッド

<T extends TNumber >オペランド<T>
call (オペランド<? extends TNumber > ラベル、オペランド<T> 予測、オペランド<T> サンプルウェイト)
損失を計算するオペランドを生成します。

継承されたメソッド

パブリックコンストラクター

public MeanAbsolutePercentageError (Ops tf)

getSimpleName()を損失名として使用し、損失削減としてREDUCTION_DEFAULTを使用して MeanAbsolutePercentageError Loss を作成します。

パラメーター
TF TensorFlow オペレーション

public MeanAbsolutePercentageError (Ops tf、 Reduction削減)

getSimpleName()を損失名として使用して MeanAbsolutePercentageError Loss を作成します

パラメーター
TF TensorFlow オペレーション
削減損失に適用する減額のタイプ。

public MeanAbsolutePercentageError (Ops tf、文字列名、 Reduction削減)

MeanAbsolutePercentageError を作成します

パラメーター
TF TensorFlow オペレーション
名前喪失の名前
削減損失に適用する減額のタイプ。

パブリックメソッド

publicオペランド<T>呼び出し(オペランド<? extends TNumber > ラベル、オペランド<T> 予測、オペランド<T> サンプルウェイト)

損失を計算するオペランドを生成します。

パラメーター
ラベル真理値またはラベル
予測予測
サンプルの重みオプションのsampleWeightsは、損失の係数として機能します。スカラーが指定されている場合、損失は指定された値によって単純にスケーリングされます。 SampleWeights がサイズ [batch_size] のテンソルの場合、バッチの各サンプルの合計損失は、SampleWeights ベクトルの対応する要素によって再スケーリングされます。 SampleWeights の形状が [batch_size, d0, .. dN-1] の場合 (またはこの形状にブロードキャストできる場合)、予測の各損失要素は、SampleWeights の対応する値によってスケーリングされます。 (dN-1 に関する注意: すべての損失関数は 1 次元ずつ減少します。通常は axis=-1 です。)
戻り値
  • 損失