Sampler

class probly.representer.sampler.Sampler(predictor: RandomPredictor[In, Out], num_samples: int, sampling_strategy: SamplingStrategy = 'sequential', sample_factory: SampleFactory[Out, S] = <flextype.singledispatch.Flexdispatch object>, sample_axis: int = -1)[source]

Bases: IterableSampler[In, Out, S], Generic[In, Out, S]

A representation predictor that creates representations from finite samples.

Initialize the sampler.

Parameters:
  • predictor – The predictor to be used for sampling.

  • num_samples – The number of samples to draw.

  • sampling_strategy – How the samples should be computed.

  • sample_factory – Factory to create the sample.

  • sample_axis – The axis along which samples are organized.

__call__(*args: In.args, **kwargs: In.kwargs) → R[source]

Alias for the represent method.

num_samples: int
predict(*args: In.args, **kwargs: In.kwargs) → R[source]

Predict the representation for a given input.

represent(*args: In.args, **kwargs: In.kwargs) → S[source]

Sample from the ensemble predictor for a given input.

sample_axis: int
sample_factory: SampleFactory
sampling_strategy: SamplingStrategy

Examples using probly.representer.sampler.Sampler

Uncertainty for Hugging Face transformers

Uncertainty for Hugging Face transformers

Uncertainty for Hugging Face vision transformers

Uncertainty for Hugging Face vision transformers

SWAG on Two Moons

SWAG on Two Moons

SWAG on MNIST

SWAG on MNIST

MC-Dropout uncertainty on a 2-D stream

MC-Dropout uncertainty on a 2-D stream

Bayesian Neural Network on Two Moons

Bayesian Neural Network on Two Moons

Bayesian Neural Network on MNIST

Bayesian Neural Network on MNIST

DropConnect on Two Moons

DropConnect on Two Moons

DropConnect on MNIST

DropConnect on MNIST

MC Dropout on Two Moons

MC Dropout on Two Moons

MC Dropout on MNIST

MC Dropout on MNIST