|
def | __init__ (self, n_mix=5, hidden=[100] *5, lr=1e-3, l2=1e-3, n_iter=1e4, batch=128, imputations=5, epsilon=1e-3, activation='relu', scalerx=None, scalery=None, model_path='Weights', model_name='MDN', no_load=False, no_save=False, seed=None, verbose=False, debug=False, **kwargs) |
|
def | predict (self, X, chunk_size=1e5, return_coefs=False, **kwargs) |
|
def | extract_predictions (self, coefs, confidence_interval=None, threshold=None, avg_est=False) |
|
def | fit (self, X, Y, output_slices=None, **kwargs) |
|
def | build (self) |
|
def | loss (self, y, output) |
|
def | __call__ (self, inputs) |
|
def | get_config (self) |
|
def | set_config (self, config, *args, **kwargs) |
|
def | update_config (self, config, keys=None) |
|
def | save (self) |
|
def | load (self) |
|
def | get_coefs (self, output) |
|
Mixture Density Network which handles multi-output, full (symmetric) covariance.
Parameters
----------
n_mix : int, optional (default=5)
Number of mixtures used in the gaussian mixture model.
hidden : list, optional (default=[100, 100, 100, 100, 100])
Number of layers and hidden units per layer in the neural network.
lr : float, optional (default=1e-3)
Learning rate for the model.
l2 : float, optional (default=1e-3)
L2 regularization scale for the model weights.
n_iter : int, optional (default=1e4)
Number of iterations to train the model for
batch : int, optional (default=128)
Size of the minibatches for stochastic optimization.
imputations : int, optional (default=5)
Number of samples used in multiple imputation when handling NaN
target values during training. More samples results in a higher
accuracy for the likelihood estimate, but takes longer and may
result in overfitting. Assumption is that any missing data is
MAR / MCAR, in order to allow a multiple imputation approach.
epsilon : float, optional (default=1e-3)
Normalization constant added to diagonal of the covariance matrix.
activation : str, optional (default=relu)
Activation function applied to hidden layers.
scalerx : transformer, optional (default=IdentityTransformer)
Transformer which has fit, transform, and inverse_transform methods
(i.e. follows the format of sklearn transformers). Scales the x
values prior to training / prediction. Stored along with the saved
model in order to have consistent inputs to the model.
scalery : transformer, optional (default=IdentityTransformer)
Transformer which has fit, transform, and inverse_transform methods
(i.e. follows the format of sklearn transformers). Scales the y
values prior to training, and the output values after prediction.
Stored along with the saved model in order to have consistent
outputs from the model.
model_path : pathlib.Path, optional (default=./Weights)
Folder location to store saved models.
model_name : str, optional (default=MDN)
Name to assign to the model.
no_load : bool, optional (default=False)
If true, train a new model rather than loading a previously
trained one.
no_save : bool, optional (default=False)
If true, do not save the model when training is completed.
seed : int, optional (default=None)
Random seed. If set, ensure consistent output.
verbose : bool, optional (default=False)
If true, print various information while loading / training.
debug : bool, optional (default=False)
If true, use control flow dependencies to determine where NaN
values are entering the model. Model runs slower with this
parameter set to true.
Definition at line 21 of file MDN.py.