code: def test_predict_proba_monty_hall():
      m1 = Categorical([[1.0 / 3, 1.0 / 3, 1.0 / 3]])
      m2 = Categorical([[1.0 / 3, 1.0 / 3, 1.0 / 3]])
      m3 = Categorical([[1.0 / 3, 1.0 / 3, 1.0 / 3]])
  
      p = numpy.array(
          [
              [[0.0, 0.5, 0.5], [0.0, 0.0, 1.0], [0.0, 1.0, 0.0]],
              [[0.0, 0.0, 1.0], [0.5, 0.0, 0.5], [1.0, 0.0, 0.0]],
              [[0.0, 1.0, 0.0], [1.0, 0.0, 0.0], [0.5, 0.5, 0.0]],
          ]
      )
  
      f1 = Categorical([[1.0 / 3, 1.0 / 3, 1.0 / 3]])
      f2 = Categorical([[1.0 / 3, 1.0 / 3, 1.0 / 3]])
      f3 = JointCategorical(p / 9.0)
  
      X = torch.tensor(
          [[0, 0, 0], [0, 1, 0], [0, 2, 0], [1, 0, 0], [2, 0, 0]]
      )
  
      mask = torch.tensor(
          [
              [False, False, False],
              [False, True, False],
              [False, True, False],
              [True, False, False],
              [True, False, False],
          ]
      )
  
      X_masked = torch.masked.MaskedTensor(X, mask=mask)
  
      model = FactorGraph(
          [f1, f2, f3],
          [m1, m2, m3],
          [(m1, f1), (m1, f3), (m2, f3), (m3, f3), (m2, f2)],
      )
      y_hat = model.predict_proba(X_masked)
  
      assert_array_almost_equal(
          y_hat[0],
          [
              [1.0 / 3, 1.0 / 3, 1.0 / 3],
              [1.0 / 3, 1.0 / 3, 1.0 / 3],
              [1.0 / 3, 1.0 / 3, 1.0 / 3],
              [0.0, 1.0, 0.0],
              [0.0, 0.0, 1.0],
          ],
      )
  
      assert_array_almost_equal(
          y_hat[1],
          [
              [1.0 / 3, 1.0 / 3, 1.0 / 3],
              [0.0, 1.0, 0.0],
              [0.0, 0.0, 1.0],
              [1.0 / 3, 1.0 / 3, 1.0 / 3],
              [1.0 / 3, 1.0 / 3, 1.0 / 3],
          ],
      )
  
      assert_array_almost_equal(
          y_hat[2],
          [
              [1.0 / 3, 1.0 / 3, 1.0 / 3],
              [0.5000, 0.0000, 0.5000],
              [0.5000, 0.5000, 0.0000],
              [0.5000, 0.0000, 0.5000],
              [0.5000, 0.5000, 0.0000],
          ],
      )
  
      X = torch.tensor(
          [
              [0, 0, 0],
              [0, 1, 0],
              [0, 2, 0],
              [1, 0, 0],
              [2, 0, 0],
              [0, 0, 1],
              [0, 1, 0],
              [2, 1, 0],
          ]
      )
  
      mask = torch.tensor(
          [
              [True, True, False],
              [True, True, False],
              [True, True, False],
              [True, True, False],
              [True, True, False],
              [False, True, True],
              [False, False, True],
              [True, False, True],
          ]
      )
  
      X_masked = torch.masked.MaskedTensor(X, mask=mask)
      y_hat = model.predict_proba(X_masked)
  
      assert_array_almost_equal(
          y_hat[0],
          [
              [1.0000, 0.0000, 0.0000],
              [1.0000, 0.0000, 0.0000],
              [1.0000, 0.0000, 0.0000],
              [0.0000, 1.0000, 0.0000],
              [0.0000, 0.0000, 1.0000],
              [1.0 / 3, 0.0000, 2.0 / 3],
              [0.0000, 0.5000, 0.5000],
              [0.0000, 0.0000, 1.0000],
          ],
      )
  
      assert_array_almost_equal(
          y_hat[1],
          [
              [1.0000, 0.0000, 0.0000],
              [0.0000, 1.0000, 0.0000],
              [0.0000, 0.0000, 1.0000],
              [1.0000, 0.0000, 0.0000],
              [1.0000, 0.0000, 0.0000],
              [1.0000, 0.0000, 0.0000],
              [0.0000, 0.5000, 0.5000],
              [0.0000, 2.0 / 3, 1.0 / 3],
          ],
      )
  
      assert_array_almost_equal(
          y_hat[2],
          [
              [0.0000, 0.5000, 0.5000],
              [0.0000, 0.0000, 1.0000],
              [0.0000, 1.0000, 0.0000],
              [0.0000, 0.0000, 1.0000],
              [0.0000, 1.0000, 0.0000],
              [0.0000, 1.0000, 0.0000],
              [1.0000, 0.0000, 0.0000],
              [1.0000, 0.0000, 0.0000],
          ],
      )
  
imports: import numpy
  import torch
  import pytest
  from pomegranate.factor_graph import FactorGraph
  from pomegranate.distributions import Exponential
  from pomegranate.distributions import Categorical
  from pomegranate.distributions import JointCategorical
  from nose.tools import assert_raises
  from numpy.testing import assert_array_almost_equal
label_desc: Use image node_id 20 for calling a global function with example usage: test_predict_proba_monty_hall() without return types