docstr: Test for updating prior Dirichlet parameters over transition likelihood (pB)
  in the case that there are mulitple hidden state factors, and there 
  are actions. All factors are updated
docstr_tok: ["Test","for","updating","prior","Dirichlet","parameters","over","transition","likelihood","(","pB",")","in","the","case","that","there","are","mulitple","hidden","state","factors",",","and","there","are","actions",".","All","factors","are","updated"]
code: def test_update_pB_multi_factor_with_actions_all_factors(self):
      """
      Test for updating prior Dirichlet parameters over transition likelihood (pB)
      in the case that there are mulitple hidden state factors, and there
      are actions. All factors are updated
      """
  
      num_states = [3, 4, 5]
      num_controls = [2, 3, 4]
      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])
  
      for factor, action_i in enumerate(action):
          validation_pB[factor][:, :, action_i] += (
              l_rate
              * maths.spm_cross(qs[factor], qs_prev[factor])
              * (B[factor][:, :, action_i] > 0)
          )
          self.assertTrue(
              np.all(pB_updated[factor] == validation_pB[factor])
          )
  
imports: import unittest
  import numpy
  from pymdp import utils, maths, learning
  from copy import deepcopy
label_desc: Use image node_id 13 for calling the TestLearning obj's underlying member method code with example usage: obj.test_update_pB_multi_factor_with_actions_all_factors() without return types