class_docstr: Particular IMM with an additional null class.
  The data is supplied together
  with a sample-related probability of being under the null.
class_docstr_tok: ["Particular","IMM","with","an","additional","null","class",".","The","data","is","supplied","together","with","a","sample-related","probability","of","being","under","the","null","."]
docstr: sample the indicator from the likelihood
  
  Parameters
  ----------
  like: array of shape (nbitem,self.k)
     component-wise likelihood
  null_class_proba: array of shape(n_samples),
                    prior probability to be under the null
  
  Returns
  -------
  z: array of shape(nbitem): a draw of the membership variable
  
  Notes
  -----
  Here z=-1 encodes for the null class
docstr_tok: ["sample","the","indicator","from","the","likelihood","Parameters","--","--","--","--","--","like",":","array","of","shape","(","nbitem",",","self.k",")","component-wise","likelihood","null_class_proba",":","array","of","shape","(","n_samples",")",",","prior","probability","to","be","under","the","null","Returns","--","--","--","-","z",":","array","of","shape","(","nbitem",")",":","a","draw","of","the","membership","variable","Notes","--","--","-","Here","z=-1","encodes","for","the","null","class"]
code: def sample_indicator(self, like, null_class_proba):
      """
      sample the indicator from the likelihood
  
      Parameters
      ----------
      like: array of shape (nbitem,self.k)
         component-wise likelihood
      null_class_proba: array of shape(n_samples),
                        prior probability to be under the null
  
      Returns
      -------
      z: array of shape(nbitem): a draw of the membership variable
  
      Notes
      -----
      Here z=-1 encodes for the null class
      """
      n = like.shape[0]
      conditional_like_1 = ((1 - null_class_proba) * like.T).T
      conditional_like_0 = np.reshape(
          null_class_proba * self.null_dens, (n, 1)
      )
      conditional_like = np.hstack(
          (conditional_like_0, conditional_like_1)
      )
      z = BGMM.sample_indicator(self, conditional_like) - 1
      z[z == self.k] = self.k + np.arange(np.sum(z == self.k))
      return z
  
imports: import math
  import numpy
  from scipy.special import gammaln
  from .bgmm import BGMM, detsh
label_desc: Use image node_id 6 for calling the MixedIMM obj's underlying member method code with example usage: obj.sample_indicator(like, null_class_proba) and returns: z