欢迎来到天天文库
浏览记录
ID:28821173
大小:43.50 KB
页数:8页
时间:2018-12-14
《改进地bp神经网络算法c语言源码》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、实用标准文案#include"stdio.h"#include"stdlib.h"#include"time.h"#include"math.h"/*********************************************inpoints为输入神经元个数,可改变outpoints为输出神经元个数defaultpoints为隐层神经元个数datagrough为样本数据个数****************************************************以下数据定义可以修改*****/#defineA0#definea1#defin
2、eb1#definec1#defineALFA0.85#defineBETA0.2//学习率0~1#defineTotal20000#defineinpoints9#defineoutpoints5#definedefaultpoints28#definedatagrough44#defineforecastdata4/**********定义所需变量********/doubleInpointData[datagrough][inpoints],OutpointData[datagrough][outpoints];/*输入输出数据*/doubleInpointD
3、ata_MAX[inpoints],InpointData_MIN[inpoints];/*每个因素最大数据*/doubleOutpointData_MAX[outpoints],OutpointData_MIN[outpoints];/*每个因素最小数据*/doublew[defaultpoints][inpoints],limen[defaultpoints],v[outpoints][defaultpoints];/*连接权值、阈值*/doubledlta_w[defaultpoints][inpoints],dlta_limen[defaultpoints]
4、,dlta_v[outpoints][defaultpoints];/*连接权、阈值修正值*/doubledefaultOutpoint[defaultpoints],Outpoint_dp[outpoints],Outpoint_ep[datagrough];/**************************读数据文件******************************/voidReadData(){FILE*fp1,*fp2;inti,j;if((fp1=fopen("D:\data\训练输入.txt","r"))==NULL){精彩文档实用标准
5、文案printf("1cannotopenthefile");exit(0);}for(i=0;i6、,"%lf",&OutpointData[i][j]);fclose(fp2);}/*****************************************************//*****************************************归一化******************************************************/voidunitary(){inti,j;intk=0;for(j=0;j7、pointData_MIN[j]中{InpointData_MAX[j]=InpointData[0][j];InpointData_MIN[j]=InpointData[0][j];for(i=0;iInpointData[i][j])InpointData_MIN[j]=InpointData[i][j];}for(j=0;
6、,"%lf",&OutpointData[i][j]);fclose(fp2);}/*****************************************************//*****************************************归一化******************************************************/voidunitary(){inti,j;intk=0;for(j=0;j7、pointData_MIN[j]中{InpointData_MAX[j]=InpointData[0][j];InpointData_MIN[j]=InpointData[0][j];for(i=0;iInpointData[i][j])InpointData_MIN[j]=InpointData[i][j];}for(j=0;
7、pointData_MIN[j]中{InpointData_MAX[j]=InpointData[0][j];InpointData_MIN[j]=InpointData[0][j];for(i=0;iInpointData[i][j])InpointData_MIN[j]=InpointData[i][j];}for(j=0;
此文档下载收益归作者所有