public class GaussianReconstructionDistribution extends Object implements ReconstructionDistribution
Specifically, the GaussianReconstructionDistribution models mean and log(stdev^2). This parameterization gives log(1) = 0,
and inputs can be in range (-infinity,infinity). Other parameterizations for variance are of course possible but may be
problematic with respect to the average pre-activation function values and activation function ranges.
For activation functions, identity and perhaps tanh are typical - though tanh (unlike identity) implies a minimum/maximum
possible value for mean and log variance. Asymmetric activation functions such as sigmoid or relu should be avoided.
| Constructor and Description |
|---|
GaussianReconstructionDistribution()
Create a GaussianReconstructionDistribution with the default identity activation function.
|
GaussianReconstructionDistribution(Activation activationFn) |
GaussianReconstructionDistribution(IActivation activationFn) |
| Modifier and Type | Method and Description |
|---|---|
int |
distributionInputSize(int dataSize)
Get the number of distribution parameters for the given input data size.
|
INDArray |
exampleNegLogProbability(INDArray x,
INDArray preOutDistributionParams)
Calculate the negative log probability for each example individually
|
INDArray |
generateAtMean(INDArray preOutDistributionParams)
Generate a sample from P(x|z), where x = E[P(x|z)]
i.e., return the mean value for the distribution
|
INDArray |
generateRandom(INDArray preOutDistributionParams)
Randomly sample from P(x|z) using the specified distribution parameters
|
INDArray |
gradient(INDArray x,
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(INDArray x,
INDArray preOutDistributionParams,
boolean average)
Calculate the negative log probability (summed or averaged over each example in the minibatch)
|
String |
toString() |
public GaussianReconstructionDistribution()
public GaussianReconstructionDistribution(Activation activationFn)
activationFn - Activation function for the reconstruction distribution. Typically identity or tanh.public GaussianReconstructionDistribution(IActivation activationFn)
activationFn - Activation function for the reconstruction distribution. Typically identity or tanh.public boolean hasLossFunction()
ReconstructionDistributionhasLossFunction in interface ReconstructionDistributionpublic int distributionInputSize(int dataSize)
ReconstructionDistributiondistributionInputSize in interface ReconstructionDistributiondataSize - Size of the data. i.e., nIn valuepublic double negLogProbability(INDArray x, INDArray preOutDistributionParams, boolean average)
ReconstructionDistributionnegLogProbability in interface ReconstructionDistributionx - 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.public INDArray exampleNegLogProbability(INDArray x, INDArray preOutDistributionParams)
ReconstructionDistributionexampleNegLogProbability in interface ReconstructionDistributionx - 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 functionpublic INDArray gradient(INDArray x, INDArray preOutDistributionParams)
ReconstructionDistributiongradient in interface ReconstructionDistributionx - DatapreOutDistributionParams - Distribution parameters used by this reconstruction distribution (for example,
mean and log variance values for Gaussian) - before applying activation functionpublic INDArray generateRandom(INDArray preOutDistributionParams)
ReconstructionDistributiongenerateRandom in interface ReconstructionDistributionpreOutDistributionParams - Distribution parameters used by this reconstruction distribution (for example,
mean and log variance values for Gaussian) - before applying activation functionpublic INDArray generateAtMean(INDArray preOutDistributionParams)
ReconstructionDistributiongenerateAtMean in interface ReconstructionDistributionpreOutDistributionParams - Distribution parameters used by this reconstruction distribution (for example,
mean and log variance values for Gaussian) - before applying activation functionCopyright © 2020. All rights reserved.