mdn_trainer
MDNTrainer
Bases: BaseTrainer
Trainer for the Mixed Density Network (MDN) model.
This class handles the training process for the MDN model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dense1_units |
int
|
Number of hidden units in first layer of the neural network. |
20
|
n_gaussians |
int
|
Number of Gaussian components in the mixture. |
5
|
**kwargs |
Additional arguments passed to the BaseTrainer. |
{}
|
Attributes:
Name | Type | Description |
---|---|---|
n_gaussians |
int
|
Number of Gaussian components in the mixture. |
model |
MDN
|
The MDN model. |
optimizer |
torch.optim.Optimizer
|
The optimizer for model training. |
Source code in uncertaintyplayground/trainers/mdn_trainer.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
|
predict_with_uncertainty(X)
Predict the output distribution given input data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
X |
np.ndarray or torch.Tensor
|
Input data of shape (num_samples, num_features). |
required |
Returns:
Name | Type | Description |
---|---|---|
tuple | A tuple containing the predicted mixture weights, means, standard deviations, and samples. |
Source code in uncertaintyplayground/trainers/mdn_trainer.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
|
train()
Train the MDN model.
Source code in uncertaintyplayground/trainers/mdn_trainer.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
|