furrer-lab / abn

Bayesian network analysis in R
https://r-bayesian-networks.org/
GNU General Public License v3.0
5 stars 0 forks source link

Session crash when specifying Poisson with decimal values #116

Open alexrai93 opened 3 months ago

alexrai93 commented 3 months ago

Hi, this code crashes my rstudio session when caching a model with poisson node containing decimal data.

I noticed that a few values I was working with had decimals and the issue was fixed when I rounded them to whole numbers.

Edit: I might suggest as it also causes issues with fitting a dag to throw an error if a Poisson node is numeric.

R 4.41 / Windows 11 Thanks!

====

options(scipen = 999) library(tidyverse) library(abn)

CarMod <- data.frame( fueltype = factor(rep(c("gas", "diesel"), each = 2, length.out = 10)), wheels = rep(c(1,2,3), each = 2, length.out = 10), length = rep(c(1,2,3), each = 2, length.out = 10) * 100, price = rep(c(1000.1, 10000, 13033, 10102, 10101),2))

dists <- list( fueltype = "binomial", wheels = "gaussian", length = "gaussian", price = "poisson" )

cache <- buildScoreCache(CarMod, data.dists = dists, method = "mle")

matteodelucchi commented 3 months ago

@j-i-l this might be related to #67

j-i-l commented 3 months ago

Hi @alexrai93,

thanks for reporting this! I'll have a closer look at this in the next few days.

j-i-l commented 2 months ago

https://github.com/furrer-lab/abn/actions/runs/10178067854/job/28150934784#step:10:298 might be related