BernoulliSampler

class tfsnippet.preprocessing.BernoulliSampler(dtype=<type 'numpy.int32'>, random_state=None)

Bases: tfsnippet.preprocessing.samplers.BaseSampler

A DataMapper which can sample 0/1 integers according to the input probability. The input is assumed to be float numbers range within [0, 1) or [0, 1].

Attributes Summary

dtype Get the data type of the sampled array.

Methods Summary

__call__(*arrays) Transform the input arrays into outputs.
sample(x) Sample array according to x.

Attributes Documentation

dtype

Get the data type of the sampled array.

Methods Documentation

__call__(*arrays)

Transform the input arrays into outputs.

Parameters:*arrays – Arrays to be transformed.
Returns:The output arrays.
Return type:tuple[np.ndarray]
sample(x)

Sample array according to x.

Parameters:x (np.ndarray) – The input x array.
Returns:The sampled array.
Return type:np.ndarray