(self, data_instances, delta_s, host_forwards)
return forwards, np.array(hess_vector)
To compute Hessian matrix, y, s are needed.
        g = (1/N)*∑(0.25 * wx - 0.5 * y) * x
        y = ∇2^F(w_t)s_t = g' * s = (1/N)*∑(0.25 * x * s) * x
        define forward_hess = (1/N)*∑(0.25 * x * s)
To compute Hessian matrix, y, s are needed.
        g = (1/N)*∑(0.25 * wx - 0.5 * y) * x
        y = ∇2^F(w_t)s_t = g' * s = (1/N)*∑(0.25 * x * s) * x
        define forward_hess = (1/N)*∑(0.25 * x * s)
To compute Hessian matrix y s are needed . g = ( 1 / N ) * ∑ ( 0 . 25 * wx - 0 . 5 * y ) * x y = ∇2^F ( w_t ) s_t = g * s = ( 1 / N ) * ∑ ( 0 . 25 * x * s ) * x define forward_hess = ( 1 / N ) * ∑ ( 0 . 25 * x * s )
def compute_forward_hess(self, data_instances, delta_s, host_forwards):
        """
        To compute Hessian matrix, y, s are needed.
        g = (1/N)*∑(0.25 * wx - 0.5 * y) * x
        y = ∇2^F(w_t)s_t = g' * s = (1/N)*∑(0.25 * x * s) * x
        define forward_hess = (1/N)*∑(0.25 * x * s)
        """
        forwards = data_instances.mapValues(
            lambda v: (vec_dot(v.features, delta_s.coef_) + delta_s.intercept_) * 0.25)
        for host_forward in host_forwards:
            forwards = forwards.join(host_forward, lambda g, h: g + (h * 0.25))
        if self.use_sample_weight:
            forwards = forwards.join(data_instances, lambda h, d: h * d.weight)
        # forward_hess = forwards.mapValues(lambda x: 0.25 * x / sample_size)
        hess_vector = self.compute_gradient(data_instances,
                                            forwards,
                                            delta_s.fit_intercept)
        return forwards, np.array(hess_vector)
def compute_forward_hess ( self , data_instances , delta_s , host_forwards ) : forwards = data_instances . mapValues ( lambda v : ( vec_dot ( v . features , delta_s . coef_ ) + delta_s . intercept_ ) * 0.25 ) for host_forward in host_forwards : forwards = forwards . join ( host_forward , lambda g , h : g + ( h * 0.25 ) ) if self . use_sample_weight : forwards = forwards . join ( data_instances , lambda h , d : h * d . weight ) # forward_hess = forwards.mapValues(lambda x: 0.25 * x / sample_size) hess_vector = self . compute_gradient ( data_instances , forwards , delta_s . fit_intercept ) return forwards , np . array ( hess_vector )