Example #1
0
 def get_el_tr_sum_loss_gradient(
         self, x_vals_seq: Sequence[X], supervisory_seq: Sequence[float],
         gamma_lambda: float) -> Sequence[np.ndarray]:
     toeplitz_mat = get_decay_toeplitz_matrix(len(x_vals_seq), gamma_lambda)
     errors = self.get_func_eval_pts(x_vals_seq) - supervisory_seq
     func_grad = self.get_feature_vals_pts(x_vals_seq)
     return [errors.dot(toeplitz_mat.dot(func_grad))]
Example #2
0
 def get_el_tr_sum_objective_gradient(
     self,
     x_vals_seq: Sequence[X],
     dObj_dOL: np.ndarray,
     factors: np.ndarray,
     gamma_lambda: float
 ) -> Sequence[np.ndarray]:
     toep = get_decay_toeplitz_matrix(len(x_vals_seq), gamma_lambda)
     features = self.get_feature_vals_pts(x_vals_seq)
     return [factors.dot(toep.dot(np.diag(dObj_dOL).dot(features)))]