텐서플로우:: ops:: LearnedUnigramCandidateSampler

#include <candidate_sampling_ops.h>

학습된 단어 분포를 사용하여 후보 샘플링을 위한 레이블을 생성합니다.

요약

후보군 추출 및 데이터 형식에 대한 설명은 go/candidate-sampling을 참조하십시오.

이 연산은 각 배치에 대해 샘플링된 후보 레이블 세트 하나를 선택합니다.

배치 단위로 후보를 샘플링하는 방식의 장점은 단순성과 효율적인 밀집 행렬 곱셈이 가능하다는 점입니다. 단점은 샘플링된 후보를 컨텍스트 및 실제 레이블과 독립적으로 선택해야 한다는 것입니다.

논거:

  • 범위: Scope 객체
  • true_classes: batch_size * num_true 크기의 행렬로, 각 행에는 해당 원본 레이블에 있는 num_true개의 target_classes의 ID가 포함됩니다.
  • num_true: 컨텍스트별 참 레이블의 개수입니다.
  • num_sampled: 무작위로 샘플링할 후보의 수입니다.
  • 고유성: 고유성이 참인 경우, 모든 샘플링된 후보가 배치에서 고유하도록 거부 샘플링을 수행합니다. 이를 위해서는 거부 후 샘플링 확률을 추정하기 위한 근사치가 필요합니다.
  • range_max: 샘플러는 [0, range_max) 범위의 정수를 샘플링합니다.

선택적 속성( Attrs 참조):

  • seed: seed 또는 seed2가 0이 아닌 값으로 설정되면, 지정된 시드를 사용하여 난수 생성기를 초기화합니다. 그렇지 않으면 임의의 시드를 사용합니다.
  • seed2: 시드 충돌을 방지하기 위한 두 번째 시드입니다.

보고:

  • Output sampled_candidates: num_sampled 길이의 벡터이며, 각 요소는 샘플링된 후보의 ID입니다.
  • Output true_expected_count: batch_size * num_true 행렬로, 샘플링된 후보들의 배치에서 각 후보가 나타날 것으로 예상되는 횟수를 나타냅니다. unique=true인 경우, 이는 확률입니다.
  • Output sampled_expected_count: 샘플링된 각 후보에 대해 해당 후보가 샘플링된 후보 배치에서 나타날 것으로 예상되는 횟수를 나타내는 num_sampled 길이의 벡터입니다. unique=true인 경우, 이는 확률입니다.

생성자와 소멸자

LearnedUnigramCandidateSampler (const :: tensorflow::Scope & scope, :: tensorflow::Input true_classes, int64 num_true, int64 num_sampled, bool unique, int64 range_max)
LearnedUnigramCandidateSampler (const :: tensorflow::Scope & scope, :: tensorflow::Input true_classes, int64 num_true, int64 num_sampled, bool unique, int64 range_max, const LearnedUnigramCandidateSampler::Attrs & attrs)

공개 속성

operation
sampled_candidates
sampled_expected_count
true_expected_count

공개 정적 함수

Seed (int64 x)
Seed2 (int64 x)

구조

텐서플로우:: ops:: LearnedUnigramCandidateSampler:: Attrs

LearnedUnigramCandidateSampler 에 대한 선택적 속성 설정기입니다.

공개 속성

작업

Operation operation

샘플링된 후보자

::tensorflow::Output sampled_candidates

샘플링된 예상 개수

::tensorflow::Output sampled_expected_count

실제_예상_수

::tensorflow::Output true_expected_count

공공 기능

학습된 유니그램 후보 샘플러

 LearnedUnigramCandidateSampler(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input true_classes,
  int64 num_true,
  int64 num_sampled,
  bool unique,
  int64 range_max
)

학습된 유니그램 후보 샘플러

 LearnedUnigramCandidateSampler(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input true_classes,
  int64 num_true,
  int64 num_sampled,
  bool unique,
  int64 range_max,
  const LearnedUnigramCandidateSampler::Attrs & attrs
)

공개 정적 함수

씨앗

Attrs Seed(
  int64 x
)

시드2

Attrs Seed2(
  int64 x
)