Check whether vertex list isn't empty, otherwise NUTS doesn't terminate.
package io.improbable.keanu.algorithms.mcmc;
+import com.google.common.base.Preconditions;
import io.improbable.keanu.algorithms.NetworkSamples;
import io.improbable.keanu.algorithms.PosteriorSamplingAlgorithm;
import io.improbable.keanu.algorithms.graphtraversal.VertexValuePropagation;
@@ -77,6 +78,7 @@ public class NUTS implements PosteriorSamplingAlgorithm {
final List<? extends Vertex> sampleFromVertices,
final int sampleCount) {
+ Preconditions.checkArgument(!sampleFromVertices.isEmpty(), "List of vertices to sample from is empty");
bayesNet.cascadeObservations();
final List<Vertex<DoubleTensor>> latentVertices = bayesNet.getContinuousLatentVertices();
