没有合适的资源?快使用搜索试试~ 我知道了~
神经网络 c版本
4星 · 超过85%的资源 需积分: 3 8 下载量 198 浏览量
2012-04-11
15:04:11
上传
评论
收藏 9KB TXT 举报
温馨提示
试读
10页
很好的神经网络c语言版本,txt文本,粘贴使用。有适当的注释
资源推荐
资源详情
资源评论
#include "stdio.h"
#include "stdlib.h"
#include "time.h"
#include "math.h"
/*********************************************
inpoints 为输入神经元个数,可改变
outpoints为输出神经元个数
defaultpoints为隐层神经元个数
datagrough为样本数据个数
**********************************************
******以下数据定义可以修改*****/
#define A 0
#define a 1
#define b 1
#define c 1
#define ALFA 0.85
#define BETA 0.2 //学习率0~1
#define Total 20000
#define inpoints 9
#define outpoints 5
#define defaultpoints 28
#define datagrough 44
#define forecastdata 4
/**********定义所需变量********/
double InpointData[datagrough][inpoints],OutpointData[datagrough][outpoints]; /* 输入输出数据 */
double InpointData_MAX[inpoints],InpointData_MIN[inpoints]; /* 每个因素最大数据 */
double OutpointData_MAX[outpoints],OutpointData_MIN[outpoints]; /* 每个因素最小数据 */
double w[defaultpoints][inpoints],limen[defaultpoints],v[outpoints][defaultpoints]; /* 连接权值、阈值 */
#include "stdlib.h"
#include "time.h"
#include "math.h"
/*********************************************
inpoints 为输入神经元个数,可改变
outpoints为输出神经元个数
defaultpoints为隐层神经元个数
datagrough为样本数据个数
**********************************************
******以下数据定义可以修改*****/
#define A 0
#define a 1
#define b 1
#define c 1
#define ALFA 0.85
#define BETA 0.2 //学习率0~1
#define Total 20000
#define inpoints 9
#define outpoints 5
#define defaultpoints 28
#define datagrough 44
#define forecastdata 4
/**********定义所需变量********/
double InpointData[datagrough][inpoints],OutpointData[datagrough][outpoints]; /* 输入输出数据 */
double InpointData_MAX[inpoints],InpointData_MIN[inpoints]; /* 每个因素最大数据 */
double OutpointData_MAX[outpoints],OutpointData_MIN[outpoints]; /* 每个因素最小数据 */
double w[defaultpoints][inpoints],limen[defaultpoints],v[outpoints][defaultpoints]; /* 连接权值、阈值 */
double dlta_w[defaultpoints][inpoints],dlta_limen[defaultpoints],dlta_v[outpoints][defaultpoints]; /* 连接权、阈值修正值 */
double defaultOutpoint[defaultpoints],Outpoint_dp[outpoints],Outpoint_ep[datagrough];
/**************************读数据文件******************************/
void ReadData()
{
FILE *fp1,*fp2;
int i,j;
if((fp1=fopen("D:\\data\\训练输入.txt","r"))==NULL)
{
printf("1can not open the file\n");
exit(0);
}
for(i=0;i<datagrough;i++)
for(j=0;j<inpoints;j++)
fscanf(fp1,"%lf",&InpointData[i][j]);
fclose(fp1);
if((fp2=fopen("D:\\data\\训练输出.txt","r"))==NULL)
{
printf("2can not open the file\n");
exit(0);
}
for(i=0;i<datagrough;i++)
for(j=0;j<outpoints;j++)
fscanf(fp2,"%lf",&OutpointData[i][j]);
fclose(fp2);
}
/*****************************************************/
/*****************************************归一化******************************************************/
double defaultOutpoint[defaultpoints],Outpoint_dp[outpoints],Outpoint_ep[datagrough];
/**************************读数据文件******************************/
void ReadData()
{
FILE *fp1,*fp2;
int i,j;
if((fp1=fopen("D:\\data\\训练输入.txt","r"))==NULL)
{
printf("1can not open the file\n");
exit(0);
}
for(i=0;i<datagrough;i++)
for(j=0;j<inpoints;j++)
fscanf(fp1,"%lf",&InpointData[i][j]);
fclose(fp1);
if((fp2=fopen("D:\\data\\训练输出.txt","r"))==NULL)
{
printf("2can not open the file\n");
exit(0);
}
for(i=0;i<datagrough;i++)
for(j=0;j<outpoints;j++)
fscanf(fp2,"%lf",&OutpointData[i][j]);
fclose(fp2);
}
/*****************************************************/
/*****************************************归一化******************************************************/
剩余9页未读,继续阅读
资源评论
- 梦阳2014-01-27可以编译,但是那几个输入和输出的文件不知道怎么用。希望有说明。
landiri
- 粉丝: 0
- 资源: 12
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功