LaplaceRepresenter¶
- class probly.method.laplace.torch.LaplaceRepresenter(predictor: BaseLaplace, num_samples: int, pred_type: str = 'glm', sampling_strategy: SamplingStrategy = 'sequential', sample_factory: SampleFactory[CategoricalDistribution, S]=<flextype.singledispatch.Flexdispatch object>, sample_axis: int = -1)[source]¶
Bases:
Sampler[In,CategoricalDistribution,S],Generic[In,S]Representer over
BaseLaplace.predictive_samples(classification only; see laplace-torch docs).- Parameters:
predictor – A fitted
BaseLaplaceinstance.num_samples – Number of posterior samples to draw.
pred_type – Forwarded to
BaseLaplace.predictive_samples; typically"glm"or"nn".sampling_strategy – How repeated predictions are computed.
sample_factory – Factory used to build the returned
Sample.sample_axis – Axis along which samples are stacked in the output tensor.
Initialize the Laplace representer.
- num_samples¶
- predict(*args: In.args, **kwargs: In.kwargs) R[source]¶
Predict the representation for a given input.
- predictor¶
- represent(*args: In.args, **kwargs: In.kwargs) S[source]¶
Bulk-sample from the posterior and return a
TorchCategoricalDistributionSample.
- sample_axis¶
- sample_factory¶
- sampling_strategy¶