Exemple #1
0
 public double Loss(NDarray <double> y, NDarray <double> p) => ND.Sq(ND.Sub(p, y)).ApplyFunc(x => x * 0.5).Data.Average();
Exemple #2
0
 public NDarray <double> Grad(NDarray <double> y, NDarray <double> p) => ND.Sub(p, y);
Exemple #3
0
 public void UpdateSGD(double lr)
 {
     Y = ND.Sub(Y, Grad.ApplyFunc(x => x * lr));
 }