MeanSquaredError

パブリック クラスMeanSquaredError

ラベルと予測の間の誤差の二乗平均を計算します。

loss = loss = square(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} });
    MeanSquaredError mse = new MeanSquaredError(tf);
    Operand<TFloat32> result = mse.call(labels, predictions);
    // produces 0.5f
 

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

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

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

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

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

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

継承されたフィールド

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

MeanSquaredError (運用 tf)
getSimpleName()を損失名として使用し、 REDUCTION_DEFAULTの損失削減を使用して MeanSquaredError 損​​失を作成します。
MeanSquaredError (Ops tf、 Reduction削減)
getSimpleName()を損失名として使用して MeanSquaredError 損​​失を作成します
MeanSquaredError (Ops tf、文字列名、 Reductionリダクション)
MeanSquaredError を作成します

パブリックメソッド

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

継承されたメソッド

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

public MeanSquaredError (Ops tf)

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

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

public MeanSquaredError (Ops tf、 Reduction削減)

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

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

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

MeanSquaredError を作成します

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