class_docstr: GMM 1D distribution.
  
  Given a set of points, we create this object so that we
  can calculate likelihoods and generate samples from this
  1D Gaussian mixture model.
  
  Attributes
  ----------
  points : 1D array
      Set of points to create the GMM
  
  N : int
      Number of points to create the GMM
  
  min_limit : Optional[float], default : -inf
      Minimum limit for the distribution
  
  max_limit : Optional[float], default : inf
      Maximum limit for the distribution
  
  weights : Optional[1D array], default : array of ones
      Used to weight the points non-uniformly if required
class_docstr_tok: ["GMM","1D","distribution",".","Given","a","set","of","points",",","we","create","this","object","so","that","we","can","calculate","likelihoods","and","generate","samples","from","this","1D","Gaussian","mixture","model",".","Attributes","--","--","--","--","--","points",":","1D","array","Set","of","points","to","create","the","GMM","N",":","int","Number","of","points","to","create","the","GMM","min_limit",":","Optional","[","float","]",",","default",":","-inf","Minimum","limit","for","the","distribution","max_limit",":","Optional","[","float","]",",","default",":","inf","Maximum","limit","for","the","distribution","weights",":","Optional","[","1D","array","]",",","default",":","array","of","ones","Used","to","weight","the","points","non-uniformly","if","required"]
docstr: Calculate the GMM likelihood for a single point.
  
  .. math::
      y = \sum_{i=1}^{N} w_i
      \times \text{normpdf}(x, x_i, \sigma_i)/\sum_{i=1}^{N} w_i
      :label: gmm-likelihood
  
  Arguments
  ---------
  x : float
      Point at which likelihood needs to be computed
  
  Returns
  -------
  float
      Likelihood value at x
docstr_tok: ["Calculate","the","GMM","likelihood","for","a","single","point",".","..","math",":",":","y","=","\\sum_","{","i=1","}","^","{","N","}","w_i","\\times","\\text","{","normpdf","}","(","x",",","x_i",",","\\sigma_i",")","\/\\sum_","{","i=1","}","^","{","N","}","w_i",":","label",":","gmm-likelihood","Arguments","--","--","--","--","-","x",":","float","Point","at","which","likelihood","needs","to","be","computed","Returns","--","--","--","-","float","Likelihood","value","at","x"]
code: def get_gmm_pdf(self, x):
      """Calculate the GMM likelihood for a single point.
  
      .. math::
          y = \\sum_{i=1}^{N} w_i
          \\times \\text{normpdf}(x, x_i, \\sigma_i)/\\sum_{i=1}^{N} w_i
          :label: gmm-likelihood
  
      Arguments
      ---------
      x : float
          Point at which likelihood needs to be computed
  
      Returns
      -------
      float
          Likelihood value at x
      """
  
      def my_norm_pdf(xt, mu, sigma):
          z = (xt - mu) / sigma
          return math.exp(-0.5 * z * z) / (
              math.sqrt(2.0 * np.pi) * sigma
          )
  
      y = 0
      if x < self.min_limit:
          return 0
      if x > self.max_limit:
          return 0
      for _x in range(self.points.size):
          y += (
              my_norm_pdf(x, self.points[_x], self.sigma[_x])
              * self.weights[_x]
          ) / self.W_sum
      return y
  
file_path: brainiak/brainiak/hyperparamopt/hpo.py
imports: import logging
  import math
  import numpy
  from scipy.special import erf
  import scipy.stats
label_desc: Use image node_id 2 for calling the gmm_1d_distribution obj's underlying member method code with example usage: obj.get_gmm_pdf(x) and returns: y, unknown, int, int