Advertisement
Guest User

rede neura l2

a guest
Aug 22nd, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1.  
  2.  
  3. package rdn;
  4.  
  5.  
  6. public class RedeNeural {
  7.  
  8. final double x1, x2, w1, w2;
  9. RedeNeural(double x1, double x2, double w1, double w2) {
  10.  
  11. this.x1 = x1;
  12. this.x2 = x2;
  13. this.w1 = w1;
  14. this.w2 = w2;
  15.  
  16. }
  17. public double getY1() {
  18.  
  19. double wx, y1;
  20.  
  21. wx = (x1 * w1) + (x2 * w2); //func propaga
  22.  
  23.  
  24. if(wx>0){
  25. y1 = 1;
  26.  
  27. }else{
  28.  
  29. y1 = 0;
  30.  
  31. }
  32. System.out.println((int) wx);
  33.  
  34.  
  35. // y1 = Math.tanh(wx); //Saida
  36.  
  37. return y1;
  38.  
  39. }
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement