docstr: Reshapes a value considering the number of variables and groups
  
  Parameter values such as `m`, `L`, and `c` may be different for the different variables and
  groups. Internally, the shape of these objects is always `(groups_n, variables_n)`.
  This method contains the logic used to map user supplied values, which may be of different
  shape and nature, into an object of shape `(groups_n, variables_n)`.
  
  The behavior of the method depends on the type of `value` in the following way.
  If value is of type...
  * `int`: the same value is recycled for all variables and groups.
  * `Sequence[int]`: it represents the values by variable and it is recycled for all groups.
  * `Sequence[Sequence[int]]`: it represents the values by variable and by group and thus
  no recycling applies. Must be of shape `(groups_n, variables_n)`.
  * `ndarray`:
      * If one dimensional, it behaves as `Sequence[int]`
      * If two dimensional, it behaves as `Sequence[Sequence[int]]`
docstr_tok: ["Reshapes","a","value","considering","the","number","of","variables","and","groups","Parameter","values","such","as","`","m","`",",","`","L","`",",","and","`","c","`","may","be","different","for","the","different","variables","and","groups",".","Internally",",","the","shape","of","these","objects","is","always","`","(","groups_n",",","variables_n",")","`",".","This","method","contains","the","logic","used","to","map","user","supplied","values",",","which","may","be","of","different","shape","and","nature",",","into","an","object","of","shape","`","(","groups_n",",","variables_n",")","`",".","The","behavior","of","the","method","depends","on","the","type","of","`","value","`","in","the","following","way",".","If","value","is","of","type","...","*","`","int","`",":","the","same","value","is","recycled","for","all","variables","and","groups",".","*","`","Sequence","[","int","]","`",":","it","represents","the","values","by","variable","and","it","is","recycled","for","all","groups",".","*","`","Sequence","[","Sequence","[","int","]","]","`",":","it","represents","the","values","by","variable","and","by","group","and","thus","no","recycling","applies",".","Must","be","of","shape","`","(","groups_n",",","variables_n",")","`",".","*","`","ndarray","`",":","*","If","one","dimensional",",","it","behaves","as","`","Sequence","[","int","]","`","*","If","two","dimensional",",","it","behaves","as","`","Sequence","[","Sequence","[","int","]","]","`"]
code: def recycle_parameter(value, variables_n: int, groups_n: int):
      """Reshapes a value considering the number of variables and groups
  
      Parameter values such as `m`, `L`, and `c` may be different for the different variables and
      groups. Internally, the shape of these objects is always `(groups_n, variables_n)`.
      This method contains the logic used to map user supplied values, which may be of different
      shape and nature, into an object of shape `(groups_n, variables_n)`.
  
      The behavior of the method depends on the type of `value` in the following way.
      If value is of type...
      * `int`: the same value is recycled for all variables and groups.
      * `Sequence[int]`: it represents the values by variable and it is recycled for all groups.
      * `Sequence[Sequence[int]]`: it represents the values by variable and by group and thus
      no recycling applies. Must be of shape `(groups_n, variables_n)`.
      * `ndarray`:
          * If one dimensional, it behaves as `Sequence[int]`
          * If two dimensional, it behaves as `Sequence[Sequence[int]]`
      """
      value = np.asarray(value)
      shape = value.shape
      if len(shape) == 0:
          output = np.tile(value, (groups_n, variables_n))
      elif len(shape) == 1:
          if shape != (variables_n,):
              raise ValueError(
                  "1D sequences must be of shape (variables_n, )"
              )
          output = np.tile(value, (groups_n, 1))
      elif len(shape) == 2:
          if shape != (groups_n, variables_n):
              raise ValueError(
                  "2D sequences must be of shape (groups_n, variables_n)"
              )
          output = value
      return output
  
file_path: bambi/bambi/transformations.py
imports: import numpy
  import pandas
  from formulae.transforms import register_stateful_transform
label_desc: Use image node_id 3 for calling the HSGP obj's underlying member method code with example usage: obj.recycle_parameter(value, variables_n, groups_n) and returns: output