Added tests for logProb at invalid (negative) values
@@ -39,6 +39,13 @@ public class HalfCauchyVertexTest {
ProbabilisticDoubleTensorContract.matchesKnownLogDensityOfScalar(tensorHalfCauchyVertex, 0.5, expectedDensity);
}
+ @Test
+ public void matchesKnownLogDensityOfNegativeScalar() {
+
+ HalfCauchyVertex tensorHalfCauchyVertex = new HalfCauchyVertex(1);
+ ProbabilisticDoubleTensorContract.matchesKnownLogDensityOfScalar(tensorHalfCauchyVertex, -0.5, Double.NEGATIVE_INFINITY);
+ }
+
@Test
public void matchesKnownLogDensityOfVector() {
@@ -48,6 +55,13 @@ public class HalfCauchyVertexTest {
ProbabilisticDoubleTensorContract.matchesKnownLogDensityOfVector(tensorHalfCauchyVertex, new double[]{0.25, 0.75}, expectedLogDensity);
}
+ @Test
+ public void matchesKnownLogDensityOfNegativeVector() {
+
+ HalfCauchyVertex tensorHalfCauchyVertex = new HalfCauchyVertex(1);
+ ProbabilisticDoubleTensorContract.matchesKnownLogDensityOfVector(tensorHalfCauchyVertex, new double[]{-0.25, 0.75}, Double.NEGATIVE_INFINITY);
+ }
+
@Test
public void matchesKnownDerivativeLogDensityOfScalar() {
