cleanup; CR
Value: [1e-9 to 1e-5]
This commit is contained in:
parent
6211d3cfb0
commit
dd942fe29e
|
@ -9,7 +9,7 @@ describe("dotSubtract", () => {
|
|||
test("mean of normal minus exponential (unit)", () => {
|
||||
let mean = 0.0
|
||||
let rate = 10.0
|
||||
|
||||
exception MeanFailed
|
||||
let dotDifference = DistributionOperation.Constructors.pointwiseSubtract(
|
||||
~env,
|
||||
mkNormal(mean, 1.0),
|
||||
|
@ -19,7 +19,7 @@ describe("dotSubtract", () => {
|
|||
let meanAnalytical = mean -. 1.0 /. rate
|
||||
switch meanResult {
|
||||
| Ok(meanValue) => meanValue->expect->toBeCloseTo(meanAnalytical)
|
||||
| Error(err) => err->expect->toBe(DistributionTypes.OperationError(DivisionByZeroError))
|
||||
| Error(_) => raise(MeanFailed)
|
||||
}
|
||||
})
|
||||
Skip.test("mean of normal minus exponential (property)", () => {
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
/*
|
||||
This test case comes via Nuño https://github.com/quantified-uncertainty/squiggle/issues/433
|
||||
*/
|
||||
open Jest
|
||||
open Expect
|
||||
|
||||
describe("KL divergence", () => {
|
||||
test("our's agrees with analytical", () => {
|
||||
true->expect->toBe(true)
|
||||
})
|
||||
})
|
|
@ -1,19 +0,0 @@
|
|||
import { testRun } from "./TestHelpers";
|
||||
|
||||
describe("KL divergence", () => {
|
||||
test.skip("by integral solver agrees with analytical", () => {
|
||||
let squiggleStringKL = `prediction=normal(4, 1)
|
||||
answer=normal(1,1)
|
||||
logSubtraction=dotSubtract(scaleLog(answer),scaleLog(prediction))
|
||||
klintegrand=dotMultiply(logSubtraction, answer)
|
||||
klintegral = integralSum(klintegrand)
|
||||
analyticalKl = log(1 / 1) + 1 ^ 2 / (2 * 1 ^ 2) + ((4 - 1) * (1 - 4) / (2 * 1 * 1)) - 1 / 2
|
||||
klintegral - analyticalKl`;
|
||||
let squiggleResultKL = testRun(squiggleStringKL);
|
||||
expect(squiggleResultKL.value).toBeCloseTo(0);
|
||||
});
|
||||
});
|
||||
|
||||
let squiggleStringLS = `prediction=normal(4,1)
|
||||
answer=normal(1,1)
|
||||
logScore(prediction, answer)`;
|
|
@ -70,4 +70,3 @@ let cauchyMakeR = (local, rate) => fmapGenDist(SymbolicDist.Cauchy.make(local, r
|
|||
let lognormalMakeR = (mu, sigma) => fmapGenDist(SymbolicDist.Lognormal.make(mu, sigma))
|
||||
let triangularMakeR = (low, mode, high) =>
|
||||
fmapGenDist(SymbolicDist.Triangular.make(low, mode, high))
|
||||
// let floatMakeR = x =>E.R.fmap(s => DistributionTypes.Symbolic(s), SymbolicDist.Float.make(x))
|
||||
|
|
Loading…
Reference in New Issue
Block a user