老师给的课件算错了==

验证了一下

 

多层前馈神经网络解决异或问题

多层前馈神经网络解决异或问题

多层前馈神经网络解决异或问题

 1 #include<iostream>
 2 #include<string.h>
 3 //前馈神经网络解决异或问题
 4 using namespace std;
 5 int sgn(float x){
 6     if(x<0) {return 0;}
 7     else return 1;
 8 }
 9 
10 int main(){
11     //int x;
12     //cin>> x;
13     //cout <<sgn(x)<<endl;
14     int a,b;//两个输入
15     float p,q,t;//p=u11,q=u12,t=2
16     cin>>a;
17     cin>>b;
18     p = a*1+(-1)*b-0.5;
19     q = a*(-1)+1*b-0.5;
20     cout<<p<<endl;
21     cout<<q<<endl;
22     //cout<<sgn(p)<<endl;
23     //cout<<sgn(q)<<endl;
24     t=sgn(p)+sgn(q)-0.5;
25     cout<<t<<endl;
26     cout<<sgn(t)<<endl;
27 
28 return 0;
29 }

 

相关文章:

  • 2021-05-29
  • 2022-03-09
  • 2022-12-23
  • 2021-12-21
  • 2021-11-07
  • 2021-09-05
  • 2021-11-25
  • 2021-10-03
猜你喜欢
  • 2021-05-07
  • 2021-11-26
  • 2021-12-04
  • 2022-12-23
  • 2021-11-17
相关资源
相似解决方案