lib.notebook.getTensor

pyagrum.lib.notebook.getTensor(pot, digits=None, withColors=None, varnames=None)

return a HTML string of a pyagrum.Tensor as a HTML table. The first dimension is special (horizontal) due to the representation of conditional probability table

Parameters:
  • pot (pyagrum.Tensor) – the tensor to show

  • digits (int) – number of digits to show

  • withColors (bool) – background for proba cells or not

  • varnames (list[str]) – the aliases for variables name in the table

Returns:

the html representation of the Tensor (as a string)

Return type:

str

Example

import pyagrum as gum
import pyagrum.lib.notebook as gnb

bn = gum.fastBN("A->B->C")
html = gnb.getTensor(bn.cpt("B"), digits=2)
html.startswith("<table")
# True