Loading TOC...

cntk:random-sample-inclusion-frequency

cntk:random-sample-inclusion-frequency(
   $weights as cntk:variable,
   $num-samples as xs:unsignedLong,
   $allow-duplicates as xs:boolean,
   [$seed as xs:unsignedLong],
   [$name as xs:string]
) as cntk:function

Summary

For weighted sampling with the specified sample size (num_samples) this operation computes the expected number of occurrences of each class in the sampled set. In case of sampling without replacement the result is only an estimate which might be quite rough in the case of small sample sizes. Intended uses are e.g. sampled softmax, noise contrastive estimation etc. This operation will be typically used together with random-sample().

Parameters
$weights Input vector of sampling weights which should be non-negative numbers.
$num-samples Number of expected samples.
$allow-duplicates If sampling is done with replacement (True) or without (False).
$seed Random seed.
$name The name of the Function instance in the network.

Example

  let $input-variable1 := cntk:input-variable(cntk:shape((3)), "float",
    fn:false(), fn:false(), "feature")
  return cntk:random-sample-inclusion-frequency($input-variable1, 2, fn:true(), 3, "y")
  => cntk:function(Composite RandomSampleInclusionFrequency (Input(Name(feature),
  Shape([3]), Dynamic Axes([Sequence Axis(Default Dynamic Axis),
  Batch Axis(Default Batch Axis)]))))

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.