Class TruncatedWrapper
- java.lang.Object
-
- org.apache.commons.math3.distribution.AbstractRealDistribution
-
- org.processmining.plugins.stochasticpetrinet.distribution.AnotherAbstractRealDistribution
-
- org.processmining.plugins.stochasticpetrinet.distribution.RejectionWrapper
-
- org.processmining.plugins.stochasticpetrinet.distribution.TruncatedWrapper
-
- All Implemented Interfaces:
java.io.Serializable,org.apache.commons.math3.analysis.UnivariateFunction,org.apache.commons.math3.distribution.RealDistribution
- Direct Known Subclasses:
MemorylessTruncatedWrapper
public class TruncatedWrapper extends RejectionWrapper
A wrapper around a distribution that cuts off a part below a certain thresholdRejectionWrapper.constraintand rescales the rest of the distribution to become a valid one again.This class should be used if samples from the original distribution are unlikely to fall into the region above the
RejectionWrapper.constraint. The sampling of random values from this distribution is done by the slice sampling technique.- Author:
- Andreas Rogge-Solti
- See Also:
for the simpler version building on rejection sampling., Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected SliceSamplersamplersampler to sample from constrained distribution directly-
Fields inherited from class org.processmining.plugins.stochasticpetrinet.distribution.RejectionWrapper
constraint, scale, wrappedDist
-
Fields inherited from class org.processmining.plugins.stochasticpetrinet.distribution.AnotherAbstractRealDistribution
cachedMean, cachedVariance
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidreseedRandomGenerator(long seed)doublesample()Slice sampling Note that due to floating point arithmetic, too large constraints, i.e.double[]sample(int sampleSize)-
Methods inherited from class org.processmining.plugins.stochasticpetrinet.distribution.RejectionWrapper
density, getSupportLowerBound, getSupportUpperBound, isSupportConnected, isSupportLowerBoundInclusive, isSupportUpperBoundInclusive
-
Methods inherited from class org.processmining.plugins.stochasticpetrinet.distribution.AnotherAbstractRealDistribution
cumulativeProbability, getNumericalMean, getNumericalVariance, value
-
-
-
-
Field Detail
-
sampler
protected SliceSampler sampler
sampler to sample from constrained distribution directly
-
-
Method Detail
-
reseedRandomGenerator
public void reseedRandomGenerator(long seed)
- Specified by:
reseedRandomGeneratorin interfaceorg.apache.commons.math3.distribution.RealDistribution- Overrides:
reseedRandomGeneratorin classRejectionWrapper
-
sample
public double sample()
Slice sampling Note that due to floating point arithmetic, too large constraints, i.e. those where the density of the truncated distribution is 0, will not work!- Specified by:
samplein interfaceorg.apache.commons.math3.distribution.RealDistribution- Overrides:
samplein classRejectionWrapper- Throws:
java.lang.IllegalArgumentException- when constraint is too high, i.e., density is (floating point rounded) zero.
-
sample
public double[] sample(int sampleSize)
- Specified by:
samplein interfaceorg.apache.commons.math3.distribution.RealDistribution- Overrides:
samplein classRejectionWrapper
-
-