TensorBFS / TensorInference.jl

Probabilistic inference using contraction of tensor networks
https://tensorbfs.github.io/TensorInference.jl/
MIT License
18 stars 2 forks source link

Arithmetic overflow or underflow when solving PR tasks #77

Closed mroavi closed 1 year ago

mroavi commented 1 year ago

Some of the tests for the PR task are not passing. I believe this issue is related to arithmetic overflow or underflow.

Here is a minimal working example:

using Test, OMEinsum, KaHyPar, TensorInference

problems = dataset_from_artifact("uai2014")["PR"]

problem_sets = [
    ("Alchemy", TreeSA(ntrials = 1, niters = 5, βs = 0.1:0.1:100)),
]

for (problem_set_name, optimizer) in problem_sets
  for (id, problem) in problems[problem_set_name]
    tn = TensorNetworkModel(read_model(problem); optimizer, evidence=read_evidence(problem))
    solution = probability(tn) |> first |> log10
    @test isapprox(solution, read_solution(problem); atol=1e-3)
  end
end
mroavi commented 1 year ago

Looking a bit deeper, it seems that the probability(tn) function does return a value equal to (exp(1396.0094457811008) * fill(1.0)). However, evaluating this operation results in an Inf value.