class_docstr: Parameter free hedging algorithm.
  
  Implementation of A Parameter-free Hedging Algorithm,
  Kamalika Chaudhuri, Yoav Freund, Daniel Hsu (2009) as a hedge-style
  algorithm.
  
  Parameters
  ----------
  n_estimators : float
      number of estimators
  T : int
      forecasting horizon (in terms of timesteps)
  a : float
      normalizing constant
  loss_func : function
      loss function which follows sklearn.metrics API, for updating weights
class_docstr_tok: ["Parameter","free","hedging","algorithm",".","Implementation","of","A","Parameter-free","Hedging","Algorithm",",","Kamalika","Chaudhuri",",","Yoav","Freund",",","Daniel","Hsu","(","2009",")","as","a","hedge-style","algorithm",".","Parameters","--","--","--","--","--","n_estimators",":","float","number","of","estimators","T",":","int","forecasting","horizon","(","in","terms","of","timesteps",")","a",":","float","normalizing","constant","loss_func",":","function","loss","function","which","follows","sklearn.metrics","API",",","for","updating","weights"]
docstr: Update forecaster weights.
  
  Update the weights on each of the estimators by performing a potential
  function update with a root-finding search. low_c represents the lower
  bound on the window that the root finding is occurring over.
  
  Parameters
  ----------
  low_c : float
      lowest value that c can take
docstr_tok: ["Update","forecaster","weights",".","Update","the","weights","on","each","of","the","estimators","by","performing","a","potential","function","update","with","a","root-finding","search",".","low_c","represents","the","lower","bound","on","the","window","that","the","root","finding","is","occurring","over",".","Parameters","--","--","--","--","--","low_c",":","float","lowest","value","that","c","can","take"]
code: def _update_weights(self, low_c=0.01):
      """Update forecaster weights.
  
      Update the weights on each of the estimators by performing a potential
      function update with a root-finding search. low_c represents the lower
      bound on the window that the root finding is occurring over.
  
      Parameters
      ----------
      low_c : float
          lowest value that c can take
      """
      # Calculating Normalizing Constant
      R_plus = np.array(list(map(lambda x: 0 if 0 > x else x, self.R)))
      normalizing_R = np.max(R_plus)
  
      R_plus /= normalizing_R
  
      low_c = low_c
      high_c = (max(R_plus) ** 2) / 2
  
      def _pot(c):
          """Calculate algorithm's potential Function.
  
          Parameters
          ----------
          low_c : float
              lowest value that c can take
  
          Returns
          -------
          potential: float
          """
          return np.mean(np.exp((R_plus**2) / (2 * c))) - np.e
  
      c_t = bisect(_pot, low_c, high_c)
  
      def _prob(r, c_t):
          """Calculate algorithm's probability Function.
  
          Parameters
          ----------
          r : float
              regret
          c_t : float
              current value for c
  
          Returns
          -------
          prob : float
              probability
          """
          return (r / c_t) * np.exp((r**2) / (2 * c_t))
  
      self.weights = np.array([_prob(r, c_t) for r in R_plus])
      self.weights /= np.sum(self.weights)
  
imports: import numpy
  from scipy.optimize import bisect, nnls
label_desc: Use image node_id 3 for calling the NormalHedgeEnsemble obj's underlying member method code with example usage: obj._update_weights(low_c) and returns: unknown, unknown