资源简介
用ANN实现的异或,使用了单隐层的BP算法。
代码片段和文件信息
#include
#include
#include
#include
#include
#define N_SAMPLES 4
/***************
网络如下:
o-------
0 \ \
2o----o3
1 / /
o-------
****************/
float X[N_SAMPLES][2] = {10011100}; //每个训练的输入
float d[N_SAMPLES] = {1100}; //每个训练的标准输出
float w03w02w13w12w23;
float theta[4];
float delta[4];
float e;
float E_sum;
float E_bar;
float E = 0.000001;
float eta = 0.001;
float v[4];
float y[4];
float abs(float a)
{
if(a>=0) return a;
if(a<0) return (0-a);
}
float sigmoid(float v)
{
float f;
f=1/(1+exp(-v));
return f;
}
float sigmoid_1(float v)
{
return sigmoid(v)*(1-sigmoid(v));
}
int init()
{
srand((unsigned)time(NULL));
w03 = rand()/32767.0 - 0.5;
w02 = rand()/32767.0 - 0.5;
w13 = rand()/32767.0 - 0.5;
w12 = rand()/32767.0 - 0.5;
w23 = rand()/32767.0 - 0.5;
theta[0] = rand()/32767.0 - 0.5;
theta[1] = rand()/32767.0 - 0.5;
theta[2] = rand()/32767.0 - 0.5;
theta[3] = rand()/32767.0 - 0.5;
}
int main()
{
init();
do
{
E_sum = 0.0;
int i;
for (i = 0;- 上一篇:基于IE浏览器的源代码
- 下一篇:C++实现日志库
相关资源
- BP神经网络C语言工程当前最终版
- 可以在单片机上计算的BP神经网络C语
- VC图像处理-用Canny算子提取边缘
- BP算法的C++实现
- 基于VC++的人脸定位系统
- 基于ANN的神经网络识别数字系统
- 利用Hopfield神经网络解决TSP问题-论文
- 深度学习之卷积神经网络CNN用于人脸
- 深度学习之卷积神经网络CNN模式识别
- 卷积神经网络代码c++
- BP神经网络实现人脸识别包含软件源码
- LeNet-5神经网络——C源代码
- c++开发的人工神经网络做人脸识别
- RBF神经网络C++源码
- 在vc下开发的canny边缘检测 MFC
- 人工神经网络之BP网络模拟三角函数
- Fast ANN神经网络算法源码
- 车牌识别 openCV mfc BP神经网络
- deep learning卷积神经网络CNN在C++环境下
- 基于C++版本的Bp神经网络,数据拟合,
- c++版神经网络实现
- C++ bp神经网络算法
- c-c++写的卷积神经网络
- 基于SVM与人工神经网络的车牌识别O
- Hopfield神经网络解决TSP问题C++程序
- canny算子MFC实现
- Manning: C++/CLI in Action
- 基于SVM与人工神经网络的车牌识别C
- Customizable Route Planning开源代码CRP
- canny边缘检测的c语言实现
川公网安备 51152502000135号
评论
共有 条评论