class_docstr: Class for event segmentation of continuous fMRI data
  
  Parameters
  ----------
  n_events: int
      Number of segments to learn
  
  step_var: Callable[[int], float] : default 4 * (0.98 ** (step - 1))
      The Gaussian variance to use during fitting, as a function of the
      number of steps. Should decrease slowly over time.
  
  n_iter: int, default: 500
      Maximum number of steps to run during fitting
  
  event_chains: ndarray with length = n_events
      Array with unique value for each separate chain of events, each linked
      in the order they appear in the array
  
  split_merge: bool, default: False
      Determines whether merge/split proposals are used during fitting with
      fit(). This can improve fitting performance when events are highly
      uneven in size, but requires additional time
  
  split_merge_proposals: int, default: 1
      Number of merges and splits to consider at each step. Computation time
      scales as O(proposals^2) so this should usually be a small value
  
  Attributes
  ----------
  p_start, p_end: length n_events+1 ndarray
      initial and final prior distributions over events
  
  P: n_events+1 by n_events+1 ndarray
      HMM transition matrix
  
  ll_ : ndarray with length = number of training datasets
      Log-likelihood for training datasets over the course of training
  
  segments_:  list of (time by event) ndarrays
      Learned (soft) segmentation for training datasets
  
  event_var_ : float
      Gaussian variance at the end of learning
  
  event_pat_ : voxel by event ndarray
      Learned mean patterns for each event
class_docstr_tok: ["Class","for","event","segmentation","of","continuous","fMRI","data","Parameters","--","--","--","--","--","n_events",":","int","Number","of","segments","to","learn","step_var",":","Callable","[","[","int","]",",","float","]",":","default","4","*","(","0.98","*","*","(","step","-","1",")",")","The","Gaussian","variance","to","use","during","fitting",",","as","a","function","of","the","number","of","steps",".","Should","decrease","slowly","over","time",".","n_iter",":","int",",","default",":","500","Maximum","number","of","steps","to","run","during","fitting","event_chains",":","ndarray","with","length","=","n_events","Array","with","unique","value","for","each","separate","chain","of","events",",","each","linked","in","the","order","they","appear","in","the","array","split_merge",":","bool",",","default",":","False","Determines","whether","merge\/split","proposals","are","used","during","fitting","with","fit","(",")",".","This","can","improve","fitting","performance","when","events","are","highly","uneven","in","size",",","but","requires","additional","time","split_merge_proposals",":","int",",","default",":","1","Number","of","merges","and","splits","to","consider","at","each","step",".","Computation","time","scales","as","O","(","proposals^2",")","so","this","should","usually","be","a","small","value","Attributes","--","--","--","--","--","p_start",",","p_end",":","length","n_events+1","ndarray","initial","and","final","prior","distributions","over","events","P",":","n_events+1","by","n_events+1","ndarray","HMM","transition","matrix","ll_",":","ndarray","with","length","=","number","of","training","datasets","Log-likelihood","for","training","datasets","over","the","course","of","training","segments_",":","list","of","(","time","by","event",")","ndarrays","Learned","(","soft",")","segmentation","for","training","datasets","event_var_",":","float","Gaussian","variance","at","the","end","of","learning","event_pat_",":","voxel","by","event","ndarray","Learned","mean","patterns","for","each","event"]
docstr: Log probability of observing each timepoint under each event model
  
  Computes the log probability of each observed timepoint being
  generated by the Gaussian distribution for each event pattern
  
  Parameters
  ----------
  data: voxel by time ndarray
      fMRI data on which to compute log probabilities
  
  mean_pat: voxel by event ndarray
      Centers of the Gaussians for each event
  
  var: float or 1D array of length equal to the number of events
      Variance of the event Gaussians. If scalar, all events are
      assumed to have the same variance
  
  Returns
  -------
  logprob : time by event ndarray
      Log probability of each timepoint under each event Gaussian
docstr_tok: ["Log","probability","of","observing","each","timepoint","under","each","event","model","Computes","the","log","probability","of","each","observed","timepoint","being","generated","by","the","Gaussian","distribution","for","each","event","pattern","Parameters","--","--","--","--","--","data",":","voxel","by","time","ndarray","fMRI","data","on","which","to","compute","log","probabilities","mean_pat",":","voxel","by","event","ndarray","Centers","of","the","Gaussians","for","each","event","var",":","float","or","1D","array","of","length","equal","to","the","number","of","events","Variance","of","the","event","Gaussians",".","If","scalar",",","all","events","are","assumed","to","have","the","same","variance","Returns","--","--","--","-","logprob",":","time","by","event","ndarray","Log","probability","of","each","timepoint","under","each","event","Gaussian"]
code: def _logprob_obs(self, data, mean_pat, var):
      """Log probability of observing each timepoint under each event model
  
      Computes the log probability of each observed timepoint being
      generated by the Gaussian distribution for each event pattern
  
      Parameters
      ----------
      data: voxel by time ndarray
          fMRI data on which to compute log probabilities
  
      mean_pat: voxel by event ndarray
          Centers of the Gaussians for each event
  
      var: float or 1D array of length equal to the number of events
          Variance of the event Gaussians. If scalar, all events are
          assumed to have the same variance
  
      Returns
      -------
      logprob : time by event ndarray
          Log probability of each timepoint under each event Gaussian
      """
  
      n_vox = data.shape[0]
      t = data.shape[1]
  
      # z-score both data and mean patterns in space, so that Gaussians
      # are measuring Pearson correlations and are insensitive to overall
      # activity changes
      data_z = stats.zscore(data, axis=0, ddof=1)
      mean_pat_z = stats.zscore(mean_pat, axis=0, ddof=1)
  
      logprob = np.empty((t, self.n_events))
  
      if type(var) is not np.ndarray:
          var = var * np.ones(self.n_events)
  
      for k in range(self.n_events):
          logprob[:, k] = (
              -0.5 * n_vox * np.log(2 * np.pi * var[k])
              - 0.5
              * np.sum((data_z.T - mean_pat_z[:, k]).T ** 2, axis=0)
              / var[k]
          )
  
      logprob /= n_vox
      return logprob
  
imports: import numpy
  from scipy import stats
  import logging
  import copy
  from sklearn.base import BaseEstimator
  from sklearn.utils.validation import check_is_fitted, check_array
  from sklearn.exceptions import NotFittedError
  import itertools
  from .None import _utils
label_desc: Use image node_id 5 for calling the EventSegment obj's underlying member method code with example usage: obj._logprob_obs(data, mean_pat, var) and returns: logprob