docstr: Test for updating prior Dirichlet parameters over sensory likelihood (pA)
  in the case that ONE observation modalities is updated and the generative model 
  has multiple hidden state factors
docstr_tok: ["Test","for","updating","prior","Dirichlet","parameters","over","sensory","likelihood","(","pA",")","in","the","case","that","ONE","observation","modalities","is","updated","and","the","generative","model","has","multiple","hidden","state","factors"]
code: def test_update_pA_multi_factor_one_modality(self):
      """
      Test for updating prior Dirichlet parameters over sensory likelihood (pA)
      in the case that ONE observation modalities is updated and the generative model
      has multiple hidden state factors
      """
      num_states = [2, 6]
      qs = utils.random_single_categorical(num_states)
      l_rate = 1.0
  
      # multiple observation modalities
      num_obs = [3, 4]
      modality_to_update = [np.random.randint(len(num_obs))]
      A = utils.random_A_matrix(num_obs, num_states)
      pA = utils.obj_array_ones([A_m.shape for A_m in A])
      observation = [utils.sample(maths.spm_dot(A_m, qs)) for A_m in A]
      pA_updated = learning.update_obs_likelihood_dirichlet(
          pA,
          A,
          observation,
          qs,
          lr=l_rate,
          modalities=modality_to_update,
      )
  
      for modality, obs_dim in enumerate(num_obs):
          if modality in modality_to_update:
              update = maths.spm_cross(
                  utils.onehot(observation[modality], obs_dim), qs
              )
              validation_pA = pA[modality] + l_rate * update
          else:
              validation_pA = pA[modality]
          self.assertTrue(np.all(pA_updated[modality] == validation_pA))
  
imports: import unittest
  import numpy
  from pymdp import utils, maths, learning
  from copy import deepcopy
label_desc: Use image node_id 5 for calling the TestLearning obj's underlying member method code with example usage: obj.test_update_pA_multi_factor_one_modality() without return types