tensorflow :: ops :: AllCandidateSampler
#include <candidate_sampling_ops.h>
学習したユニグラム分布を使用して、候補サンプリングのラベルを生成します。
概要
go / candidate-samplingで候補者のサンプリングとデータ形式の説明を参照してください。
この操作では、バッチごとに、サンプリングされた候補ラベルの単一のセットが選択されます。
バッチごとに候補をサンプリングすることの利点は、単純さと効率的な密行列乗算の可能性です。欠点は、サンプリングされた候補がコンテキストや実際のラベルとは無関係に選択されなければならないことです。
引数:
- スコープ:スコープオブジェクト
- true_classes:batch_size * num_trueマトリックス。各行には、対応する元のラベルのnum_truetarget_classesのIDが含まれます。
- num_true:コンテキストごとの真のラベルの数。
- num_sampled:生成する候補の数。
- unique:uniqueがtrueの場合、バッチ内のすべてのサンプリングされた候補が一意になるように、拒否を使用してサンプリングします。これには、棄却後のサンプリング確率を推定するための近似が必要です。
オプションの属性(参照Attrs
):
- seed:seedまたはseed2のいずれかがゼロ以外に設定されている場合、乱数ジェネレーターは指定されたシードによってシードされます。それ以外の場合は、ランダムシードによってシードされます。
- seed2:シードの衝突を回避するための2番目のシード。
戻り値:
-
Output
sampled_candidates:長さnum_sampledのベクトル。各要素は、サンプリングされた候補のIDです。 -
Output
true_expected_count:batch_size * num_true行列。これは、サンプリングされた候補のバッチで各候補が発生すると予想される回数を表します。 unique = trueの場合、これは確率です。 -
Output
sampled_expected_count:サンプリングされた候補のバッチで候補が発生すると予想される回数を表す、サンプリングされた候補ごとの長さnum_sampledのベクトル。 unique = trueの場合、これは確率です。
コンストラクタとデストラクタ | |
---|---|
AllCandidateSampler (const :: tensorflow::Scope & scope, :: tensorflow::Input true_classes, int64 num_true, int64 num_sampled, bool unique) | |
AllCandidateSampler (const :: tensorflow::Scope & scope, :: tensorflow::Input true_classes, int64 num_true, int64 num_sampled, bool unique, const AllCandidateSampler::Attrs & attrs) |
パブリック属性 | |
---|---|
operation | |
sampled_candidates | |
sampled_expected_count | |
true_expected_count |
パブリック静的関数 | |
---|---|
Seed (int64 x) | |
Seed2 (int64 x) |
構造体 | |
---|---|
tensorflow :: ops :: AllCandidateSampler :: Attrs | AllCandidateSamplerのオプションの属性セッター。 |
パブリック属性
操作
Operation operation
sampled_candidates
::tensorflow::Output sampled_candidates
sampled_expected_count
::tensorflow::Output sampled_expected_count
true_expected_count
::tensorflow::Output true_expected_count
公の行事
AllCandidateSampler
AllCandidateSampler( const ::tensorflow::Scope & scope, ::tensorflow::Input true_classes, int64 num_true, int64 num_sampled, bool unique )
AllCandidateSampler
AllCandidateSampler( const ::tensorflow::Scope & scope, ::tensorflow::Input true_classes, int64 num_true, int64 num_sampled, bool unique, const AllCandidateSampler::Attrs & attrs )
パブリック静的関数
シード
Attrs Seed( int64 x )
Seed2
Attrs Seed2( int64 x )