docstr: Test for updating prior Dirichlet parameters over transition likelihood (pB)
  in the case that the one and only hidden state factor is updated, and there 
  are no actions.
docstr_tok: ["Test","for","updating","prior","Dirichlet","parameters","over","transition","likelihood","(","pB",")","in","the","case","that","the","one","and","only","hidden","state","factor","is","updated",",","and","there","are","no","actions","."]
code: def test_update_pB_single_factor_no_actions(self):
      """
      Test for updating prior Dirichlet parameters over transition likelihood (pB)
      in the case that the one and only hidden state factor is updated, and there
      are no actions.
      """
  
      num_states = [3]
      num_controls = [
          1
      ]  # this is how we encode the fact that there aren't any actions
      qs_prev = utils.random_single_categorical(num_states)
      qs = utils.random_single_categorical(num_states)
      l_rate = 1.0
  
      B = utils.random_B_matrix(num_states, num_controls)
      pB = utils.obj_array_ones([B_f.shape for B_f in B])
  
      action = np.array(
          [np.random.randint(c_dim) for c_dim in num_controls]
      )
  
      pB_updated = learning.update_state_likelihood_dirichlet(
          pB, B, action, qs, qs_prev, lr=l_rate, factors="all"
      )
  
      validation_pB = utils.obj_array_ones([B_f.shape for B_f in B])
      validation_pB[0][:, :, 0] += (
          l_rate
          * maths.spm_cross(qs[0], qs_prev[0])
          * (B[0][:, :, action[0]] > 0)
      )
      self.assertTrue(np.all(pB_updated[0] == validation_pB[0]))
  
imports: import unittest
  import numpy
  from pymdp import utils, maths, learning
  from copy import deepcopy
label_desc: Use image node_id 8 for calling the TestLearning obj's underlying member method code with example usage: obj.test_update_pB_single_factor_no_actions() without return types