MeanAbsoluteError

パブリック クラスMeanAbsoluteError

ラベルと予測の間の絶対差の平均を計算します。

loss = abs(labels - predictions)

スタンドアロン使用:

    Operand<TFloat32> labels =
        tf.constant(new float[][] { {0.f, 1.f}, {0.f, 0.f} });
    Operand<TFloat32> predictions =
        tf.constant(new float[][] { {1.f, 1.f}, {1.f, 0.f} });
    MeanAbsoluteError mae = new MeanAbsoluteError(tf);
    Operand<TFloat32> result = mae.call(labels, predictions);
    // produces 0.5f
 

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

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

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

    MeanAbsoluteError mae = new MeanAbsoluteError(tf, Reduction.SUM);
    Operand<TFloat32> result = mae.call(labels, predictions);
    // produces 1.0f
 

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

    MeanAbsoluteError mae = new MeanAbsoluteError(tf, Reduction.NONE);
    Operand<TFloat32> result = mae.call(labels, predictions);
    // produces [0.5f, 0.5f]
 

継承されたフィールド

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

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

パブリックメソッド

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

継承されたメソッド

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

パブリックMeanAbsoluteError (Ops tf)

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

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

public MeanAbsoluteError (Ops tf、 Reductionリダクション)

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

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

public MeanAbsoluteError (Ops tf、文字列名、 Reductionリダクション)

MeanAbsoluteError を作成します

パラメーター
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 です。)
戻り値
  • 損失