資源描述:
《改進(jìn)地bp神經(jīng)網(wǎng)絡(luò)算法c語言源碼》由會員上傳分享,免費在線閱讀,更多相關(guān)內(nèi)容在工程資料-天天文庫。
1、實用標(biāo)準(zhǔn)文案#include"stdio.h"#include"stdlib.h"#include"time.h"#include"math.h"/*********************************************inpoints為輸入神經(jīng)元個數(shù),可改變outpoints為輸出神經(jīng)元個數(shù)defaultpoints為隱層神經(jīng)元個數(shù)datagrough為樣本數(shù)據(jù)個數(shù)****************************************************以下數(shù)據(jù)定義可以修改*****/#defineA0#definea1#defin
2、eb1#definec1#defineALFA0.85#defineBETA0.2//學(xué)習(xí)率0~1#defineTotal20000#defineinpoints9#defineoutpoints5#definedefaultpoints28#definedatagrough44#defineforecastdata4/**********定義所需變量********/doubleInpointData[datagrough][inpoints],OutpointData[datagrough][outpoints];/*輸入輸出數(shù)據(jù)*/doubleInpointD
3、ata_MAX[inpoints],InpointData_MIN[inpoints];/*每個因素最大數(shù)據(jù)*/doubleOutpointData_MAX[outpoints],OutpointData_MIN[outpoints];/*每個因素最小數(shù)據(jù)*/doublew[defaultpoints][inpoints],limen[defaultpoints],v[outpoints][defaultpoints];/*連接權(quán)值、閾值*/doubledlta_w[defaultpoints][inpoints],dlta_limen[defaultpoints]
4、,dlta_v[outpoints][defaultpoints];/*連接權(quán)、閾值修正值*/doubledefaultOutpoint[defaultpoints],Outpoint_dp[outpoints],Outpoint_ep[datagrough];/**************************讀數(shù)據(jù)文件******************************/voidReadData(){FILE*fp1,*fp2;inti,j;if((fp1=fopen("D:\data\訓(xùn)練輸入.txt","r"))==NULL){精彩文檔實用標(biāo)準(zhǔn)
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;