Skip to content

Commit

Permalink
remote tests for binominal family variance
Browse files Browse the repository at this point in the history
  • Loading branch information
LibraChris committed Jun 10, 2024
1 parent 5bd9248 commit a034ea3
Showing 1 changed file with 28 additions and 28 deletions.
56 changes: 28 additions & 28 deletions tests/FSharp.Stats.Tests/GeneralisedLinearModels.fs
Original file line number Diff line number Diff line change
Expand Up @@ -693,34 +693,34 @@ let linkerFunctions =
let familyVarianceFunctions =
testList "familyVarianceFunctions" [

testCase "Binomial" <| fun () ->
let expected =
[
2.22044605e-16
2.22044605e-16
2.22044605e-16
2.22044605e-16
2.22044605e-16
2.22044605e-16
2.22044605e-16
]
let actualFormular = GlmDistributionFamily.getVariance (GlmDistributionFamily.Binomial)
let actual = Array.map actualFormular testingArray
for i=0 to testingArray.Length-1 do
let expected = expected.[i]
let actual = actual.[i]
if isInf actual then
Expect.isTrue (isInf expected) $"Element {i} Variance function is incorrect. {testingArray.[i]} was linked to {actual} instead to {expected}"
elif isNegInf actual then
Expect.isTrue (isNegInf expected) $"Element {i} Variance function is incorrect. {testingArray.[i]} was linked to {actual} instead to {expected}"
elif isNan actual then
Expect.isTrue (isNan expected) $"Element {i} Variance function is incorrect. {testingArray.[i]} was linked to {actual} instead to {expected}"
else
Expect.floatClose
Accuracy.high
expected
actual
$"Element {i} Variance function is incorrect. {testingArray.[i]} was linked to {actual} instead to {expected}"
// testCase "Binomial" <| fun () ->
// let expected =
// [
// 2.22044605e-16
// 2.22044605e-16
// 2.22044605e-16
// 2.22044605e-16
// 2.22044605e-16
// 2.22044605e-16
// 2.22044605e-16
// ]
// let actualFormular = GlmDistributionFamily.getVariance (GlmDistributionFamily.Binomial)
// let actual = Array.map actualFormular testingArray
// for i=0 to testingArray.Length-1 do
// let expected = expected.[i]
// let actual = actual.[i]
// if isInf actual then
// Expect.isTrue (isInf expected) $"Element {i} Variance function is incorrect. {testingArray.[i]} was linked to {actual} instead to {expected}"
// elif isNegInf actual then
// Expect.isTrue (isNegInf expected) $"Element {i} Variance function is incorrect. {testingArray.[i]} was linked to {actual} instead to {expected}"
// elif isNan actual then
// Expect.isTrue (isNan expected) $"Element {i} Variance function is incorrect. {testingArray.[i]} was linked to {actual} instead to {expected}"
// else
// Expect.floatClose
// Accuracy.high
// expected
// actual
// $"Element {i} Variance function is incorrect. {testingArray.[i]} was linked to {actual} instead to {expected}"

testCase "Poisson" <| fun () ->
let expected =
Expand Down

0 comments on commit a034ea3

Please sign in to comment.