class_docstr: A gamma distribution object.
  
  A gamma distribution is the sum of exponential distributions, and has shape
  and rate parameters. This distribution assumes that each feature is
  independent of the others. 
  
  There are two ways to initialize this objecct. The first is to pass in
  the tensor of rate and shae parameters, at which point they can immediately 
  be used. The second is to not pass in the rate parameters and then call
  either `fit` or `summary` + `from_summaries`, at which point the rate
  and shape parameters will be learned from data.
  
  
  Parameters
  ----------
  shapes: torch.tensor or None, shape=(d,), optional
          The shape parameter for each feature. Default is None
  
  rates: torch.tensor or None, shape=(d,), optional
          The rate parameters for each feature. Default is None.
  
  inertia: float, (0, 1), optional
          Indicates the proportion of the update to apply to the parameters
          during training. When the inertia is 0.0, the update is applied in
          its entirety and the previous parameters are ignored. When the
          inertia is 1.0, the update is entirely ignored and the previous
          parameters are kept, equivalently to if the parameters were frozen.
  
  tol: float, [0, inf), optional
          The threshold at which to stop fitting the parameters of the
          distribution. Default is 1e-4.
  
  max_iter: int, [0, inf), optional
          The maximum number of iterations to run EM when fitting the parameters
          of the distribution. Default is 20.
  
  frozen: bool, optional
          Whether all the parameters associated with this distribution are frozen.
          If you want to freeze individual pameters, or individual values in those
          parameters, you must modify the `frozen` attribute of the tensor or
          parameter directly. Default is False.
  
  check_data: bool, optional
          Whether to check properties of the data and potentially recast it to
          torch.tensors. This does not prevent checking of parameters but can
          slightly speed up computation when you know that your inputs are valid.
          Setting this to False is also necessary for compiling.
class_docstr_tok: ["A","gamma","distribution","object",".","A","gamma","distribution","is","the","sum","of","exponential","distributions",",","and","has","shape","and","rate","parameters",".","This","distribution","assumes","that","each","feature","is","independent","of","the","others",".","There","are","two","ways","to","initialize","this","objecct",".","The","first","is","to","pass","in","the","tensor","of","rate","and","shae","parameters",",","at","which","point","they","can","immediately","be","used",".","The","second","is","to","not","pass","in","the","rate","parameters","and","then","call","either","`","fit","`","or","`","summary","`","+","`","from_summaries","`",",","at","which","point","the","rate","and","shape","parameters","will","be","learned","from","data",".","Parameters","--","--","--","--","--","shapes",":","torch.tensor","or","None",",","shape=","(","d",",",")",",","optional","The","shape","parameter","for","each","feature",".","Default","is","None","rates",":","torch.tensor","or","None",",","shape=","(","d",",",")",",","optional","The","rate","parameters","for","each","feature",".","Default","is","None",".","inertia",":","float",",","(","0",",","1",")",",","optional","Indicates","the","proportion","of","the","update","to","apply","to","the","parameters","during","training",".","When","the","inertia","is","0.0",",","the","update","is","applied","in","its","entirety","and","the","previous","parameters","are","ignored",".","When","the","inertia","is","1.0",",","the","update","is","entirely","ignored","and","the","previous","parameters","are","kept",",","equivalently","to","if","the","parameters","were","frozen",".","tol",":","float",",","[","0",",","inf",")",",","optional","The","threshold","at","which","to","stop","fitting","the","parameters","of","the","distribution",".","Default","is","1e-4",".","max_iter",":","int",",","[","0",",","inf",")",",","optional","The","maximum","number","of","iterations","to","run","EM","when","fitting","the","parameters","of","the","distribution",".","Default","is","20.","frozen",":","bool",",","optional","Whether","all","the","parameters","associated","with","this","distribution","are","frozen",".","If","you","want","to","freeze","individual","pameters",",","or","individual","values","in","those","parameters",",","you","must","modify","the","`","frozen","`","attribute","of","the","tensor","or","parameter","directly",".","Default","is","False",".","check_data",":","bool",",","optional","Whether","to","check","properties","of","the","data","and","potentially","recast","it","to","torch.tensors",".","This","does","not","prevent","checking","of","parameters","but","can","slightly","speed","up","computation","when","you","know","that","your","inputs","are","valid",".","Setting","this","to","False","is","also","necessary","for","compiling","."]
docstr: Reset the internally stored statistics.
  
  This method is meant to only be called internally. It resets the
  stored statistics used to update the model parameters as well as
  recalculates the cached values meant to speed up log probability
  calculations.
docstr_tok: ["Reset","the","internally","stored","statistics",".","This","method","is","meant","to","only","be","called","internally",".","It","resets","the","stored","statistics","used","to","update","the","model","parameters","as","well","as","recalculates","the","cached","values","meant","to","speed","up","log","probability","calculations","."]
code: def _reset_cache(self):
      """Reset the internally stored statistics.
  
      This method is meant to only be called internally. It resets the
      stored statistics used to update the model parameters as well as
      recalculates the cached values meant to speed up log probability
      calculations.
      """
  
      if self._initialized == False:
          return
  
      self.register_buffer(
          "_w_sum", torch.zeros(self.d, device=self.device)
      )
      self.register_buffer(
          "_xw_sum", torch.zeros(self.d, device=self.device)
      )
      self.register_buffer(
          "_logx_w_sum", torch.zeros(self.d, device=self.device)
      )
  
      self.register_buffer("_log_rates", torch.log(self.rates))
      self.register_buffer("_lgamma_shapes", torch.lgamma(self.shapes))
      self.register_buffer(
          "_thetas", self._log_rates * self.shapes - self._lgamma_shapes
      )
  
file_path: pomegranate/pomegranate/distributions/gamma.py
imports: import torch
  from .._utils import _cast_as_tensor
  from .._utils import _cast_as_parameter
  from .._utils import _update_parameter
  from .._utils import _check_parameter
  from .._utils import _check_shapes
  from ._distribution import Distribution
label_desc: Use image node_id 3 for calling the Gamma obj's underlying member method code with example usage: obj._reset_cache() without return types