docstr: Test removing hidden state factor levels and/or observation levels from the priors vectors
  of a generative model, using the `_prune_prior` function of the `learning` module
docstr_tok: ["Test","removing","hidden","state","factor","levels","and\/or","observation","levels","from","the","priors","vectors","of","a","generative","model",",","using","the","`","_prune_prior","`","function","of","the","`","learning","`","module"]
code: def test_prune_prior(self):
      """
      Test removing hidden state factor levels and/or observation levels from the priors vectors
      of a generative model, using the `_prune_prior` function of the `learning` module
      """
  
      """ Test 1a. Testing `_prune_prior()` in case of a single hidden state factor/modality """
  
      num_levels_total = 4  # this could either be 4 hidden state levels, or 4 observation levels
      test_prior = utils.random_single_categorical([num_levels_total])[
          0
      ]
  
      levels_to_remove = [2]
  
      reduced_prior = learning._prune_prior(
          test_prior, levels_to_remove
      )
  
      self.assertTrue(
          len(reduced_prior)
          == (num_levels_total - len(levels_to_remove))
      )
      self.assertTrue(utils.is_normalized(reduced_prior))
  
      """ Test 1b. Testing `_prune_prior()` in case of multiple hidden state factors/modalities """
  
      num_levels_total = [
          4,
          5,
      ]  # this could either be 4 hidden state levels, or 4 observation levels
      test_prior = utils.random_single_categorical(num_levels_total)
  
      levels_to_remove = [[2, 3], []]
  
      reduced_prior = learning._prune_prior(
          test_prior, levels_to_remove
      )
  
      for f, ns in enumerate(num_levels_total):
          self.assertTrue(
              len(reduced_prior[f]) == (ns - len(levels_to_remove[f]))
          )
          self.assertTrue(utils.is_normalized(reduced_prior[f]))
  
      """ Test 1c. Testing `_prune_prior()` in case of multiple hidden state factors/modalities, and where you're removing all the levels of a particular factor """
  
      num_levels_total = [
          4,
          5,
      ]  # this could either be 4 hidden state levels, or 4 observation levels
      test_prior = utils.random_single_categorical(num_levels_total)
  
      levels_to_remove = [[2, 3], list(range(5))]
  
      reduced_prior = learning._prune_prior(
          test_prior, levels_to_remove
      )
  
      self.assertTrue(
          len(reduced_prior[0])
          == (num_levels_total[0] - len(levels_to_remove[0]))
      )
      self.assertTrue(utils.is_normalized(reduced_prior[0]))
  
      self.assertTrue(len(reduced_prior) == (len(levels_to_remove) - 1))
  
imports: import unittest
  import numpy
  from pymdp import utils, maths, learning
  from copy import deepcopy
label_desc: Use image node_id 18 for calling the TestLearning obj's underlying member method code with example usage: obj.test_prune_prior() without return types