docstr: Test for updating prior Dirichlet parameters over transition likelihood (pB)
  in the case that there are mulitple hidden state factors, some of which 
  are controllable. Some 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",",","some","of","which","are","controllable",".","Some","factors","are","updated","."]
code: def test_update_pB_multi_factor_some_controllable_some_factors(self):
      """
      Test for updating prior Dirichlet parameters over transition likelihood (pB)
      in the case that there are mulitple hidden state factors, some of which
      are controllable. Some factors are updated.
      """
  
      num_states = [3, 4, 5]
      num_controls = [2, 1, 1]
      qs_prev = utils.random_single_categorical(num_states)
      qs = utils.random_single_categorical(num_states)
      l_rate = 1.0
  
      factors_to_update = [0, 1]
  
      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=factors_to_update,
      )
  
      validation_pB = utils.obj_array_ones([B_f.shape for B_f in B])
  
      for factor, action_i in enumerate(action):
          if factor in factors_to_update:
              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 16 for calling the TestLearning obj's underlying member method code with example usage: obj.test_update_pB_multi_factor_some_controllable_some_factors() without return types