MCDropoutLayer<T>
Layers · AiDotNet.UncertaintyQuantification.Layers
Implements Monte Carlo Dropout layer for uncertainty estimation in neural networks.
Inheritance: LayerBase<T> → MCDropoutLayer<T>
Implements: IShapeContract
For Beginners
Monte Carlo Dropout is a simple yet powerful technique for estimating uncertainty.
Unlike regular dropout which is only active during training, MC Dropout keeps dropout active during prediction as well. By running multiple predictions with different random dropout masks, we get a distribution of predictions. The spread of this distribution tells us how uncertain the model is.
Think of it like asking multiple slightly different versions of the same expert for their opinion. If they all agree, you can be confident. If they disagree widely, there’s high uncertainty.
This is particularly useful for:
- Detecting out-of-distribution samples
- Active learning (selecting which data to label next)
- Safety-critical applications (knowing when to defer to a human expert)
Constructors
| Constructor | Summary |
|---|---|
MCDropoutLayer(double dropoutRate, bool mcMode, int? randomSeed) |
Initializes a new instance of the MCDropoutLayer class. |
Properties
| Property | Summary |
|---|---|
bool MonteCarloMode { get; set; } |
Gets or sets whether Monte Carlo mode is enabled (applies dropout during inference). |
bool SupportsTraining { get; } |
Gets a value indicating whether this layer supports training mode. |
Methods
| Method | Summary |
|---|---|
IReadOnlyList<OutputAxisContract> OutputAxesFor(int inputRank) |
Derived from this type’s [TensorLayout] declarations. |
void ResetState() |
Resets the internal state of the layer. |