code: def test_log_probability(X, means, covs):
      m, c = [1.7], [1.3]
      x = [[1.0], [2.0], [4.0], [3.0], [2.0]]
      y = [-1.368777, -1.1777, -2.84635, -1.852076, -1.1777]
  
      x_torch = torch.tensor(numpy.array(x))
      m_torch = torch.tensor(numpy.array(m))
      c_torch = torch.sqrt(torch.tensor(numpy.array(c)))
  
      d1 = StudentT(3, m, c)
      d2 = StudentT(
          3,
          numpy.array(m, dtype=numpy.float64),
          numpy.array(c, dtype=numpy.float64),
      )
      d3 = torch.distributions.StudentT(3, m_torch, c_torch)
  
      _test_predictions(x, y, d1.log_probability(x), torch.float32)
      _test_predictions(x, y, d2.log_probability(x), torch.float64)
      _test_predictions(
          x,
          d3.log_prob(x_torch).sum(axis=1),
          d2.log_probability(x),
          torch.float64,
      )
  
      p = [1.7, 2.3, 1.0, 1.7, 4.1]
      x = [[1.0, 2.0, 4.0, 3.0, 2.0]]
      y = [-10.824243]
  
      p_torch = torch.tensor(numpy.array(p))
      x_torch = torch.tensor(numpy.array(x))
  
      d1 = StudentT(3, p, p)
      d2 = StudentT(
          3,
          numpy.array(p, dtype=numpy.float64),
          numpy.array(p, dtype=numpy.float64),
      )
      d3 = torch.distributions.StudentT(3, p_torch, torch.sqrt(p_torch))
  
      _test_predictions(x, y, d1.log_probability(x), torch.float32)
      _test_predictions(x, y, d2.log_probability(x), torch.float64)
      _test_predictions(
          x,
          d3.log_prob(x_torch).sum(axis=1),
          d2.log_probability(x),
          torch.float64,
      )
  
      p = [1, 2, 4]
      x = [[1, 2, 1], [2, 2, 1], [1, 1, 3], [2, 1, 2]]
      y = [-5.161619, -5.736983, -4.510774, -5.501417]
  
      p_torch = torch.tensor(numpy.array(p))
      x_torch = torch.tensor(numpy.array(x))
  
      d1 = StudentT(3, p, p)
      d2 = StudentT(
          3,
          numpy.array(p, dtype=numpy.float64),
          numpy.array(p, dtype=numpy.float64),
      )
      d3 = torch.distributions.StudentT(3, p_torch, torch.sqrt(p_torch))
  
      _test_predictions(x, y, d1.log_probability(x), torch.float32)
      _test_predictions(x, y, d2.log_probability(x), torch.float64)
      _test_predictions(
          x,
          d3.log_prob(x_torch).sum(axis=1),
          d2.log_probability(x),
          torch.float64,
      )
  
      p = [1.0, 2.0, 4.0]
      p_torch = torch.tensor(numpy.array(p))
  
      d1 = StudentT(3, p, p)
      d2 = StudentT(
          3,
          numpy.array(p, dtype=numpy.float64),
          numpy.array(p, dtype=numpy.float64),
      )
      d3 = torch.distributions.StudentT(3, p_torch, torch.sqrt(p_torch))
  
      _test_predictions(x, y, d1.log_probability(x), torch.float32)
      _test_predictions(x, y, d2.log_probability(x), torch.float64)
      _test_predictions(
          x,
          d3.log_prob(x_torch).sum(axis=1),
          d2.log_probability(x),
          torch.float64,
      )
  
      m_torch = torch.tensor(numpy.array(means))
      c_torch = torch.tensor(numpy.array(covs))
      x_torch = torch.tensor(numpy.array(X))
  
      y = [
          -4.173189,
          -4.740443,
          -3.252754,
          -6.305667,
          -8.179995,
          -10.499344,
          -6.099453,
      ]
  
      d2 = StudentT(
          3,
          numpy.array(means, dtype=numpy.float64),
          numpy.array(covs, dtype=numpy.float64),
      )
      d3 = torch.distributions.StudentT(3, m_torch, torch.sqrt(c_torch))
  
      _test_predictions(X, y, d2.log_probability(X), torch.float64)
      _test_predictions(
          X,
          d3.log_prob(x_torch).sum(axis=1),
          d2.log_probability(X),
          torch.float64,
      )
  
imports: import os
  import numpy
  import torch
  import pytest
  from pomegranate.distributions import StudentT
  from ._utils import _test_initialization_raises_two_parameters
  from ._utils import _test_initialization
  from ._utils import _test_predictions
  from ._utils import _test_efd_from_summaries
  from ._utils import _test_raises
  from nose.tools import assert_raises
  from numpy.testing import assert_array_almost_equal
label_desc: Use image node_id 16 for calling a global function with example usage: test_log_probability(X, means, covs) without return types