### Question:
PoissonVertex extends VertexImpl<IntegerTensor, IntegerVertex> implements IntegerVertex, ProbabilisticInteger, SamplableWithManyScalars<IntegerTensor>, LogProbGraphSupplier { @Override public LogProbGraph logProbGraph() { IntegerPlaceholderVertex valuePlaceholder = new IntegerPlaceholderVertex(this.getShape()); DoublePlaceholderVertex muPlaceholder = new DoublePlaceholderVertex(mu.getShape()); return LogProbGraph.builder() .input(this, valuePlaceholder) .input(mu, muPlaceholder) .logProbOutput(Poisson.logProbOutput(valuePlaceholder, muPlaceholder)) .build(); } PoissonVertex(@LoadShape long[] shape,
                         @LoadVertexParam(MU_NAME) Vertex<DoubleTensor, ?> mu);  PoissonVertex(long[] shape, double mu); @ExportVertexToPythonBindings  PoissonVertex(Vertex<DoubleTensor, ?> mu);  PoissonVertex(double mu); @SaveVertexParam(MU_NAME) DoubleVertex getMu(); @Override double logProb(IntegerTensor value); @Override LogProbGraph logProbGraph(); @Override Map<Vertex, DoubleTensor> dLogProb(IntegerTensor value, Set<? extends Vertex> withRespectTo); @Override IntegerTensor sampleWithShape(long[] shape, KeanuRandom random);  }### Answer:
@Test public void logProbGraphForValuesGreaterThanTwenty() { DoubleVertex mu = ConstantVertex.of(25.0); PoissonVertex poissonVertex = new PoissonVertex(mu); LogProbGraph logProbGraph = poissonVertex.logProbGraph(); LogProbGraphValueFeeder.feedValue(logProbGraph, mu, mu.getValue()); PoissonDistribution distribution = new PoissonDistribution(25); LogProbGraphValueFeeder.feedValueAndCascade(logProbGraph, poissonVertex, IntegerTensor.scalar(19)); LogProbGraphContract.matchesKnownLogDensity(logProbGraph, distribution.logProbability(19)); LogProbGraphValueFeeder.feedValueAndCascade(logProbGraph, poissonVertex, IntegerTensor.scalar(20)); LogProbGraphContract.matchesKnownLogDensity(logProbGraph, distribution.logProbability(20)); LogProbGraphValueFeeder.feedValueAndCascade(logProbGraph, poissonVertex, IntegerTensor.scalar(100)); LogProbGraphContract.matchesKnownLogDensity(logProbGraph, distribution.logProbability(100)); }
@Test public void logProbGraphMatchesKnownLogProb() { DoubleVertex mu = ConstantVertex.of(new double[]{5, 7}); PoissonVertex poissonVertex = new PoissonVertex(mu); LogProbGraph logProbGraph = poissonVertex.logProbGraph(); LogProbGraphValueFeeder.feedValue(logProbGraph, mu, mu.getValue()); LogProbGraphValueFeeder.feedValue(logProbGraph, poissonVertex, IntegerTensor.create(39, 49)); PoissonDistribution distribution1 = new PoissonDistribution(5); PoissonDistribution distribution2 = new PoissonDistribution(7); double expectedLogProb = distribution1.logProbability(39) + distribution2.logProbability(49); LogProbGraphContract.matchesKnownLogDensity(logProbGraph, expectedLogProb); }