Skip to content

Smoothing seems to be non-functioning #8

@mlindsk

Description

@mlindsk

Hi,

I have gRain version 1.3.6 and gRbase version 1.8.6.7. Setting the smooth argument doesn't seem to work. Consider the markov random field:

library(ess)
g <- ess::as_igraph(ess::fit_graph(derma, q = 0))

In that graphical model, the evidence (h25 = "0", h27 = "3") is inconsistent. I.e. there are clique potentials for which this combination is never observed. However, using smoothing a small number (here 0.1) should be added to these "zero-cells" and things should run out of the box. However, I get the following:

gr  <- gRain::grain(igraph::as_graphnel(g), data = derma)
grc <- gRbase::compile(gr, propagate = FALSE, smooth = 0.1)
grc <- gRain::setEvidence(grc, nodes = c("h25", "h27"), states = c("0", "3"), propagate = TRUE)
gRain::querygrain(grc, "ES")

$ES
ES
      chronic dermatitis            lichen planus         pityriasis rosea 
                     NaN                      NaN                      NaN 
pityriasis rubra pilaris                psoriasis      seboreic dermatitis 
                     NaN                      NaN                      NaN

Maybe I'm doing something wrong here?

/Mads

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions