code: def BIC(self,data=None):
          '''
          BIC on the passed data. If passed data is None (default), calculates BIC
          on the model's assigned data
          '''
          # NOTE: in principle this method computes the BIC only after finding the
          # maximum likelihood parameters (or, of course, an EM fixed-point as an
          # approximation!)
          assert data is None and len(self.states_list) > 0, 'Must have data to get BIC'
          if data is None:
              return -2*sum(self.log_likelihood(s.data).sum() for s in self.states_list) + \
                          self.num_parameters() * np.log(
                                  sum(s.data.shape[0] for s in self.states_list))
          else:
              return -2*self.log_likelihood(data) + self.num_parameters() * np.log(data.shape[0]f BIC(self,data=None):
          '''
          BIC on the passed data. If passed data is None (default), calculates BIC
          on the model's assigned data
          '''
          # NOTE: in principle this method computes the BIC only after finding the
          # maximum likelihood parameters (or, of course, an EM fixed-point as an
          # approximation!)
          assert data is None and len(self.states_list) > 0, 'Must have data to get BIC'
          if data is None:
              return -2*sum(self.log_likelihood(s.data).sum() for s in self.states_list) + \
                          self.num_parameters() * np.log(
                                  sum(s.data.shape[0] for s in self.states_list))
          else:
              return -2*self.log_likelihood(data) + self.num_parameters() * np.log(data.shape[0])
docs: BIC on the passed data. If passed data is None (default), calculates BIC
          on the model's assigned data