public interface ReconstructionDistribution
extends java.io.Serializable
VariationalAutoencoder
to specify the form of the distribution p(data|x). For example, real-valued data could be modelled
by a GaussianReconstructionDistribution
, whereas binary data could be modelled by a BernoulliReconstructionDistribution
.
To model multiple types of data in the one data vector, use CompositeReconstructionDistribution
.
Modifier and Type | Method and Description |
---|---|
int |
distributionInputSize(int dataSize)
Get the number of distribution parameters for the given input data size.
|
org.nd4j.linalg.api.ndarray.INDArray |
exampleNegLogProbability(org.nd4j.linalg.api.ndarray.INDArray x,
org.nd4j.linalg.api.ndarray.INDArray preOutDistributionParams)
Calculate the negative log probability for each example individually
|
org.nd4j.linalg.api.ndarray.INDArray |
generateAtMean(org.nd4j.linalg.api.ndarray.INDArray preOutDistributionParams)
Generate a sample from P(x|z), where x = E[P(x|z)]
i.e., return the mean value for the distribution
|
org.nd4j.linalg.api.ndarray.INDArray |
generateRandom(org.nd4j.linalg.api.ndarray.INDArray preOutDistributionParams)
Randomly sample from P(x|z) using the specified distribution parameters
|
org.nd4j.linalg.api.ndarray.INDArray |
gradient(org.nd4j.linalg.api.ndarray.INDArray x,
org.nd4j.linalg.api.ndarray.INDArray preOutDistributionParams)
Calculate the gradient of the negative log probability with respect to the preOutDistributionParams
|
boolean |
hasLossFunction()
Does this reconstruction distribution has a standard neural network loss function (such as mean squared error,
which is deterministic) or is it a standard VAE with a probabilistic reconstruction distribution?
|
double |
negLogProbability(org.nd4j.linalg.api.ndarray.INDArray x,
org.nd4j.linalg.api.ndarray.INDArray preOutDistributionParams,
boolean average)
Calculate the negative log probability (summed or averaged over each example in the minibatch)
|
boolean hasLossFunction()
int distributionInputSize(int dataSize)
dataSize
- Size of the data. i.e., nIn valuedouble negLogProbability(org.nd4j.linalg.api.ndarray.INDArray x, org.nd4j.linalg.api.ndarray.INDArray preOutDistributionParams, boolean average)
x
- Data to be modelled (reconstructions)preOutDistributionParams
- Distribution parameters used by this reconstruction distribution (for example,
mean and log variance values for Gaussian)average
- Whether the log probability should be averaged over the minibatch, or simply summed.org.nd4j.linalg.api.ndarray.INDArray exampleNegLogProbability(org.nd4j.linalg.api.ndarray.INDArray x, org.nd4j.linalg.api.ndarray.INDArray preOutDistributionParams)
x
- Data to be modelled (reconstructions)preOutDistributionParams
- Distribution parameters used by this reconstruction distribution (for example,
mean and log variance values for Gaussian) - before applying activation functionorg.nd4j.linalg.api.ndarray.INDArray gradient(org.nd4j.linalg.api.ndarray.INDArray x, org.nd4j.linalg.api.ndarray.INDArray preOutDistributionParams)
x
- DatapreOutDistributionParams
- Distribution parameters used by this reconstruction distribution (for example,
mean and log variance values for Gaussian) - before applying activation functionorg.nd4j.linalg.api.ndarray.INDArray generateRandom(org.nd4j.linalg.api.ndarray.INDArray preOutDistributionParams)
preOutDistributionParams
- Distribution parameters used by this reconstruction distribution (for example,
mean and log variance values for Gaussian) - before applying activation functionorg.nd4j.linalg.api.ndarray.INDArray generateAtMean(org.nd4j.linalg.api.ndarray.INDArray preOutDistributionParams)
preOutDistributionParams
- Distribution parameters used by this reconstruction distribution (for example,
mean and log variance values for Gaussian) - before applying activation function