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.
  
  The weights are updated over the estimators by passing previous
  observations and updating based on Normal Hedge.
  
  Parameters
  ----------
  y_pred : np.array(), shape=(time_axis,estimator_axis)
      array with predictions from the estimators
  y_true : np.array(), shape=(time_axis)
      array with actual values for predicted quantity
docstr_tok: ["Update","forecaster","weights",".","The","weights","are","updated","over","the","estimators","by","passing","previous","observations","and","updating","based","on","Normal","Hedge",".","Parameters","--","--","--","--","--","y_pred",":","np.array","(",")",",","shape=","(","time_axis",",","estimator_axis",")","array","with","predictions","from","the","estimators","y_true",":","np.array","(",")",",","shape=","(","time_axis",")","array","with","actual","values","for","predicted","quantity"]
code: def update(self, y_pred, y_true, low_c=0.01):
      """Update forecaster weights.
  
      The weights are updated over the estimators by passing previous
      observations and updating based on Normal Hedge.
  
      Parameters
      ----------
      y_pred : np.array(), shape=(time_axis,estimator_axis)
          array with predictions from the estimators
      y_true : np.array(), shape=(time_axis)
          array with actual values for predicted quantity
      """
      assert y_pred.shape[1] == len(y_true), "Time Dimension Matches"
      time_length = y_pred.shape[1]
  
      for i in range(time_length):
          loss_vector = np.array(
              [
                  self.loss_func([prediction], [y_true[i]])
                  for prediction in y_pred[:, i]
              ]
          )
  
          average_loss = np.dot(self.weights, loss_vector)
  
          instant_regret = average_loss - loss_vector
          self.R += instant_regret
          self._update_weights(low_c=low_c)
  
imports: import numpy
  from scipy.optimize import bisect, nnls
label_desc: Use image node_id 2 for calling the NormalHedgeEnsemble obj's underlying member method code with example usage: obj.update(y_pred, y_true, low_c) without return types