docstr: Evaluate the values and set internal parameters
  
  See `pymc.gp.HSGP` for more details about the parameters `m`, `L`, `c`, and `drop_first`.
  
  Parameters
  ----------
  m : int, Sequence[int], ndarray
      The number of basis vectors. See `HSGP.reconciliate_shape` to see how it is
      broadcasted/recycled.
  L : float, Sequence[float], Sequence[Sequence[float]], ndarray, optional
      The boundary of the variable space. See `HSGP.reconciliate_shape` to see how it is
      broadcasted/recycled. Defaults to `None`.
  c : float, Sequence[float], Sequence[Sequence[float]], ndarray, optional
      The proportion extension factor. Se `HSGP.reconciliate_shape` to see how it is
      broadcasted/recycled. Defaults to `None`.
  by : array-like, optional
      The values of a variable to group by. It is used to create a HSGP term by group.
      Defaults to `None`.
  cov : str, optional
      The name of the covariance function to use. Defaults to "ExpQuad".
  share_cov : bool, optional
      Whether to share the same covariance function for every group. Defaults to `True`.
  scale : bool, optional
      When `True`, the predictors are be rescaled such that the largest Euclidean
      distance between two points is 1. This adjustment often improves the sampling speed and
      convergence. The rescaling also impacts the estimated length-scale parameters,
      which will resemble those of the scaled predictors rather than the original predictors
      when `scale` is `True`. Defaults to `None`, which means the behavior depends on whether
      custom priors are passed or not. If custom priors are used, `None` is translated to
      `False`. If automatic priors are used, `None` is translated to `True`.
  iso : bool, optional
      Determines whether to use an isotropic or non-isotropic Gaussian Process.
      If isotropic, the same level of smoothing is applied to all predictors,
      while non-isotropic GPs allow different levels of smoothing for individual predictors.
      This parameter is ignored if only one predictor is supplied. Defaults to `True`.
  drop_first : bool, optional
      Whether to ignore the first basis vector or not. Defaults to `False`.
  centered : bool, optional
      Whether to use the centered or the non-centered parametrization. Defaults to `False`.
  
  Returns
  -------
  values
      A NumPy array of shape (observations_n, variables_n) or
      (observations_n, variables_n + 1) if `by` is not None.
  
  Raises
  ------
  ValueError
      When both `L` and `c` are `None` or when both of them are not `None` at the same time.
docstr_tok: ["Evaluate","the","values","and","set","internal","parameters","See","`","pymc.gp.HSGP","`","for","more","details","about","the","parameters","`","m","`",",","`","L","`",",","`","c","`",",","and","`","drop_first","`",".","Parameters","--","--","--","--","--","m",":","int",",","Sequence","[","int","]",",","ndarray","The","number","of","basis","vectors",".","See","`","HSGP.reconciliate_shape","`","to","see","how","it","is","broadcasted\/recycled",".","L",":","float",",","Sequence","[","float","]",",","Sequence","[","Sequence","[","float","]","]",",","ndarray",",","optional","The","boundary","of","the","variable","space",".","See","`","HSGP.reconciliate_shape","`","to","see","how","it","is","broadcasted\/recycled",".","Defaults","to","`","None","`",".","c",":","float",",","Sequence","[","float","]",",","Sequence","[","Sequence","[","float","]","]",",","ndarray",",","optional","The","proportion","extension","factor",".","Se","`","HSGP.reconciliate_shape","`","to","see","how","it","is","broadcasted\/recycled",".","Defaults","to","`","None","`",".","by",":","array-like",",","optional","The","values","of","a","variable","to","group","by",".","It","is","used","to","create","a","HSGP","term","by","group",".","Defaults","to","`","None","`",".","cov",":","str",",","optional","The","name","of","the","covariance","function","to","use",".","Defaults","to","``","ExpQuad","''",".","share_cov",":","bool",",","optional","Whether","to","share","the","same","covariance","function","for","every","group",".","Defaults","to","`","True","`",".","scale",":","bool",",","optional","When","`","True","`",",","the","predictors","are","be","rescaled","such","that","the","largest","Euclidean","distance","between","two","points","is","1",".","This","adjustment","often","improves","the","sampling","speed","and","convergence",".","The","rescaling","also","impacts","the","estimated","length-scale","parameters",",","which","will","resemble","those","of","the","scaled","predictors","rather","than","the","original","predictors","when","`","scale","`","is","`","True","`",".","Defaults","to","`","None","`",",","which","means","the","behavior","depends","on","whether","custom","priors","are","passed","or","not",".","If","custom","priors","are","used",",","`","None","`","is","translated","to","`","False","`",".","If","automatic","priors","are","used",",","`","None","`","is","translated","to","`","True","`",".","iso",":","bool",",","optional","Determines","whether","to","use","an","isotropic","or","non-isotropic","Gaussian","Process",".","If","isotropic",",","the","same","level","of","smoothing","is","applied","to","all","predictors",",","while","non-isotropic","GPs","allow","different","levels","of","smoothing","for","individual","predictors",".","This","parameter","is","ignored","if","only","one","predictor","is","supplied",".","Defaults","to","`","True","`",".","drop_first",":","bool",",","optional","Whether","to","ignore","the","first","basis","vector","or","not",".","Defaults","to","`","False","`",".","centered",":","bool",",","optional","Whether","to","use","the","centered","or","the","non-centered","parametrization",".","Defaults","to","`","False","`",".","Returns","--","--","--","-","values","A","NumPy","array","of","shape","(","observations_n",",","variables_n",")","or","(","observations_n",",","variables_n","+","1",")","if","`","by","`","is","not","None",".","Raises","--","--","--","ValueError","When","both","`","L","`","and","`","c","`","are","`","None","`","or","when","both","of","them","are","not","`","None","`","at","the","same","time","."]
code: def __call__(
      self,
      *x,
      m,
      L=None,
      c=None,
      by=None,
      cov="ExpQuad",
      share_cov=True,
      scale=None,
      iso=True,
      drop_first=False,
      centered=False,
  ):
      """Evaluate the values and set internal parameters
  
      See `pymc.gp.HSGP` for more details about the parameters `m`, `L`, `c`, and `drop_first`.
  
      Parameters
      ----------
      m : int, Sequence[int], ndarray
          The number of basis vectors. See `HSGP.reconciliate_shape` to see how it is
          broadcasted/recycled.
      L : float, Sequence[float], Sequence[Sequence[float]], ndarray, optional
          The boundary of the variable space. See `HSGP.reconciliate_shape` to see how it is
          broadcasted/recycled. Defaults to `None`.
      c : float, Sequence[float], Sequence[Sequence[float]], ndarray, optional
          The proportion extension factor. Se `HSGP.reconciliate_shape` to see how it is
          broadcasted/recycled. Defaults to `None`.
      by : array-like, optional
          The values of a variable to group by. It is used to create a HSGP term by group.
          Defaults to `None`.
      cov : str, optional
          The name of the covariance function to use. Defaults to "ExpQuad".
      share_cov : bool, optional
          Whether to share the same covariance function for every group. Defaults to `True`.
      scale : bool, optional
          When `True`, the predictors are be rescaled such that the largest Euclidean
          distance between two points is 1. This adjustment often improves the sampling speed and
          convergence. The rescaling also impacts the estimated length-scale parameters,
          which will resemble those of the scaled predictors rather than the original predictors
          when `scale` is `True`. Defaults to `None`, which means the behavior depends on whether
          custom priors are passed or not. If custom priors are used, `None` is translated to
          `False`. If automatic priors are used, `None` is translated to `True`.
      iso : bool, optional
          Determines whether to use an isotropic or non-isotropic Gaussian Process.
          If isotropic, the same level of smoothing is applied to all predictors,
          while non-isotropic GPs allow different levels of smoothing for individual predictors.
          This parameter is ignored if only one predictor is supplied. Defaults to `True`.
      drop_first : bool, optional
          Whether to ignore the first basis vector or not. Defaults to `False`.
      centered : bool, optional
          Whether to use the centered or the non-centered parametrization. Defaults to `False`.
  
      Returns
      -------
      values
          A NumPy array of shape (observations_n, variables_n) or
          (observations_n, variables_n + 1) if `by` is not None.
  
      Raises
      ------
      ValueError
          When both `L` and `c` are `None` or when both of them are not `None` at the same time.
      """
      values = np.column_stack(x)
  
      if by is not None:
          # Generate indexes according to the original 'by_levels'
          if self.params_set:
              by_indexes = pd.Categorical(
                  by, categories=self.by_levels
              ).codes
          # Determine unique levels and store them, only for the first time
          else:
              by_levels, by_indexes = np.unique(by, return_inverse=True)
              self.by_levels = by_levels
      else:
          by_indexes = None
  
      if not self.params_set:
          if (L is None and c is None) or (
              L is not None and c is not None
          ):
              raise ValueError("Provide one of 'c' or 'L'")
  
          # Number of variables and number of groups
          self.variables_n = values.shape[1]
          self.groups_n = (
              1 if self.by_levels is None else len(self.by_levels)
          )
  
          m = np.asarray(m)
          if not (m.ndim == 0 or m.shape == (self.variables_n,)):
              raise ValueError(
                  "'m' must be scalar or a sequence with length equal to the number of variables"
              )
  
          # The number of basis functions cannot vary by level of the grouping variable
          # It makes the implementation simpler and... why would you do that?!
          self.m = self.recycle_parameter(m, self.variables_n, 1)
  
          if L is not None:
              L = self.recycle_parameter(
                  L, self.variables_n, self.groups_n
              )
          if c is not None:
              c = self.recycle_parameter(
                  c, self.variables_n, self.groups_n
              )
  
          self.L = L
          self.c = c
          self.cov = cov
          self.share_cov = share_cov
          self.scale = scale
          self.iso = iso
          self.drop_first = drop_first
          self.centered = centered
          self.mean = mean_by_group(values, by)
          self.maximum_distance = np.max(get_distance(values))
          self.params_set = True
  
      if by_indexes is not None:
          # The indexes of the 'by' variable is the last column of the matrix returned
          # Note this would certainly cast variables from int to float
          # So we must take care of it when using the indexes in 'by'
          values = np.column_stack([values, by_indexes])
  
      return values
  
file_path: bambi/bambi/transformations.py
imports: import numpy
  import pandas
  from formulae.transforms import register_stateful_transform
label_desc: Use image node_id 2 for calling the HSGP obj's underlying member method code with example usage: obj.__call__() and returns: values