Interface ReconstructionDistribution
-
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
BernoulliReconstructionDistribution
,CompositeReconstructionDistribution
,ExponentialReconstructionDistribution
,GaussianReconstructionDistribution
,LossFunctionWrapper
public interface ReconstructionDistribution extends Serializable
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method 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 individuallyINDArray
generateAtMean(INDArray preOutDistributionParams)
Generate a sample from P(x|z), where x = E[P(x|z)] i.e., return the mean value for the distributionINDArray
generateRandom(INDArray preOutDistributionParams)
Randomly sample from P(x|z) using the specified distribution parametersINDArray
gradient(INDArray x, INDArray preOutDistributionParams)
Calculate the gradient of the negative log probability with respect to the preOutDistributionParamsboolean
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)
-
-
-
Method Detail
-
hasLossFunction
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?- Returns:
- true if the reconstruction distribution has a loss function only (and no probabilistic reconstruction distribution)
-
distributionInputSize
int distributionInputSize(int dataSize)
Get the number of distribution parameters for the given input data size. For example, a Gaussian distribution has 2 parameters value (mean and log(variance)) for each data value, whereas a Bernoulli distribution has only 1 parameter value (probability) for each data value.- Parameters:
dataSize
- Size of the data. i.e., nIn value- Returns:
- Number of distribution parameters for the given reconstruction distribution
-
negLogProbability
double negLogProbability(INDArray x, INDArray preOutDistributionParams, boolean average)
Calculate the negative log probability (summed or averaged over each example in the minibatch)- Parameters:
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.- Returns:
- Average or sum of negative log probability of the reconstruction given the distribution parameters
-
exampleNegLogProbability
INDArray exampleNegLogProbability(INDArray x, INDArray preOutDistributionParams)
Calculate the negative log probability for each example individually- Parameters:
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 function- Returns:
- Negative log probability of the reconstruction given the distribution parameters, for each example individually. Column vector, shape [numExamples, 1]
-
gradient
INDArray gradient(INDArray x, INDArray preOutDistributionParams)
Calculate the gradient of the negative log probability with respect to the preOutDistributionParams- Parameters:
x
- DatapreOutDistributionParams
- Distribution parameters used by this reconstruction distribution (for example, mean and log variance values for Gaussian) - before applying activation function- Returns:
- Gradient with respect to the preOutDistributionParams
-
generateRandom
INDArray generateRandom(INDArray preOutDistributionParams)
Randomly sample from P(x|z) using the specified distribution parameters- Parameters:
preOutDistributionParams
- Distribution parameters used by this reconstruction distribution (for example, mean and log variance values for Gaussian) - before applying activation function- Returns:
- A random sample of x given the distribution parameters
-
generateAtMean
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- Parameters:
preOutDistributionParams
- Distribution parameters used by this reconstruction distribution (for example, mean and log variance values for Gaussian) - before applying activation function- Returns:
- A deterministic sample of x (mean/expected value) given the distribution parameters
-
-