class_docstr: Normal distribution with tensorflow-probability back-end.
  
  Parameters
  ----------
  mean : float or array of float (1D or 2D)
      mean of the normal distribution
  sd : float or array of float (1D or 2D), must be positive
      standard deviation of the normal distribution
  index : pd.Index, optional, default = RangeIndex
  columns : pd.Index, optional, default = RangeIndex
  
  Example
  -------
  >>> from sktime.proba.tfp import TFNormal  # doctest: +SKIP
  
  >>> n = TFNormal(mu=[[0, 1], [2, 3], [4, 5]], sigma=1)  # doctest: +SKIP
class_docstr_tok: ["Normal","distribution","with","tensorflow-probability","back-end",".","Parameters","--","--","--","--","--","mean",":","float","or","array","of","float","(","1D","or","2D",")","mean","of","the","normal","distribution","sd",":","float","or","array","of","float","(","1D","or","2D",")",",","must","be","positive","standard","deviation","of","the","normal","distribution","index",":","pd.Index",",","optional",",","default","=","RangeIndex","columns",":","pd.Index",",","optional",",","default","=","RangeIndex","Example","--","--","--","-",">",">",">","from","sktime.proba.tfp","import","TFNormal","#","doctest",":","+SKIP",">",">",">","n","=","TFNormal","(","mu=","[","[","0",",","1","]",",","[","2",",","3","]",",","[","4",",","5","]","]",",","sigma=1",")","#","doctest",":","+SKIP"]
docstr: Energy of self, w.r.t. self or a constant frame x.
  
  Let :math:`X, Y` be i.i.d. random variables with the distribution of `self`.
  
  If `x` is `None`, returns :math:`\mathbb{E}[|X-Y|]` (per row), "self-energy".
  If `x` is passed, returns :math:`\mathbb{E}[|X-x|]` (per row), "energy wrt x".
  
  Parameters
  ----------
  x : None or pd.DataFrame, optional, default=None
      if pd.DataFrame, must have same rows and columns as `self`
  
  Returns
  -------
  pd.DataFrame with same rows as `self`, single column `"energy"`
  each row contains one float, self-energy/energy as described above.
docstr_tok: ["Energy","of","self",",","w.r.t",".","self","or","a","constant","frame","x",".","Let",":","math",":","`","X",",","Y","`","be","i.i.d",".","random","variables","with","the","distribution","of","`","self","`",".","If","`","x","`","is","`","None","`",",","returns",":","math",":","`","\\mathbb","{","E","}","[","|X-Y|","]","`","(","per","row",")",",","``","self-energy","''",".","If","`","x","`","is","passed",",","returns",":","math",":","`","\\mathbb","{","E","}","[","|X-x|","]","`","(","per","row",")",",","``","energy","wrt","x","''",".","Parameters","--","--","--","--","--","x",":","None","or","pd.DataFrame",",","optional",",","default=None","if","pd.DataFrame",",","must","have","same","rows","and","columns","as","`","self","`","Returns","--","--","--","-","pd.DataFrame","with","same","rows","as","`","self","`",",","single","column","`","``","energy","''","`","each","row","contains","one","float",",","self-energy\/energy","as","described","above","."]
code: def energy(self, x=None):
      r"""Energy of self, w.r.t. self or a constant frame x.
  
      Let :math:`X, Y` be i.i.d. random variables with the distribution of `self`.
  
      If `x` is `None`, returns :math:`\mathbb{E}[|X-Y|]` (per row), "self-energy".
      If `x` is passed, returns :math:`\mathbb{E}[|X-x|]` (per row), "energy wrt x".
  
      Parameters
      ----------
      x : None or pd.DataFrame, optional, default=None
          if pd.DataFrame, must have same rows and columns as `self`
  
      Returns
      -------
      pd.DataFrame with same rows as `self`, single column `"energy"`
      each row contains one float, self-energy/energy as described above.
      """
      if x is None:
          sd_arr = self._sigma
          energy_arr = 2 * np.sum(sd_arr, axis=1) / np.sqrt(np.pi)
          energy = pd.DataFrame(
              energy_arr, index=self.index, columns=["energy"]
          )
      else:
          mu_arr, sd_arr = self._mu, self._sigma
          c_arr = (x - mu_arr) * (
              2 * self.cdf(x) - 1
          ) + 2 * sd_arr**2 * self.pdf(x)
          energy_arr = np.sum(c_arr, axis=1)
          energy = pd.DataFrame(
              energy_arr, index=self.index, columns=["energy"]
          )
      return energy
  
file_path: sktime/sktime/proba/tfp.py
imports: import numpy
  import pandas
  from sktime.proba.base import _BaseTFDistribution
  from sktime.utils.validation._dependencies import _check_estimator_deps
label_desc: Use image node_id 2 for calling the TFNormal obj's underlying member method code with example usage: obj.energy(x) and returns: energy