code: def _beta_func(a, b):
      """
  
      A naive implementation with (math.gamma(a) + math.gamma(b)) / math.gamma(a + b) would
      overflow for large values of a and b.
  
      See https://malishoaib.wordpress.com/2014/04/15/the-beautiful-beta-functions-in-raw-python/
      for more details.
  
      """
      return math.exp(
          math.lgamma(a) + math.lgamma(b) - math.lgamma(a + b)
      )
  
file_path: river/river/proba/beta.py
imports: from __future__ import annotations
  import math
  import scipy.special
  from river.proba import base
label_desc: Use image node_id 1 for calling a global function with example usage: _beta_func(a, b) and returns: math