神经网络bp算法,求源代码改进 200
10个数据推一个数据作为训练,然后预测,请问有改进方案吗。程序如下%输入样本PP=[0.139991-0.09250.2082240.035245-0.157810.18...
10个数据推一个数据作为训练,然后预测,请问有改进方案吗。程序如下
%输入样本P
P=[0.139991 -0.0925 0.208224 0.035245 -0.15781 0.186609 -0.10978 0.042804 -0.37464 0.571837 -0.18424 0.104407 -0.30953 0.433872;
-0.0925 0.208224 0.035245 -0.15781 0.186609 -0.10978 0.042804 -0.37464 0.571837 -0.18424 0.104407 -0.30953 0.433872 -0.55118;
0.208224 0.035245 -0.15781 0.186609 -0.10978 0.042804 -0.37464 0.571837 -0.18424 0.104407 -0.30953 0.433872 -0.55118 0.254276;
0.035245 -0.15781 0.186609 -0.10978 0.042804 -0.37464 0.571837 -0.18424 0.104407 -0.30953 0.433872 -0.55118 0.254276 0.032833;
-0.15781 0.186609 -0.10978 0.042804 -0.37464 0.571837 -0.18424 0.104407 -0.30953 0.433872 -0.55118 0.254276 0.032833 -0.13925;
0.186609 -0.10978 0.042804 -0.37464 0.571837 -0.18424 0.104407 -0.30953 0.433872 -0.55118 0.254276 0.032833 -0.13925 0.195242;
-0.10978 0.042804 -0.37464 0.571837 -0.18424 0.104407 -0.30953 0.433872 -0.55118 0.254276 0.032833 -0.13925 0.195242 -0.04116;
0.042804 -0.37464 0.571837 -0.18424 0.104407 -0.30953 0.433872 -0.55118 0.254276 0.032833 -0.13925 0.195242 -0.04116 -0.07635;
-0.37464 0.571837 -0.18424 0.104407 -0.30953 0.433872 -0.55118 0.254276 0.032833 -0.13925 0.195242 -0.04116 -0.07635 0.091929;
0.571837 -0.18424 0.104407 -0.30953 0.433872 -0.55118 0.254276 0.032833 -0.13925 0.195242 -0.04116 -0.07635 0.091929 -0.09311];
%目标输出T
T =[-0.18424 0.104407 -0.30953 0.433872 -0.55118 0.254276 0.032833 -0.13925 0.195242 -0.04116 -0.07635 0.091929 -0.09311 0.109063];
>> net=newelm(minmax(P),[9,1],{'tansig','logsig'},'traingdx');
>> net.trainParam.epochs=1000;
net.trainParam.goal=0.01;
LP.lr=0.1;
net=train(net,P,T);
P1=[-0.55118
0.254276
0.032833
-0.13925
0.195242
-0.04116
-0.07635
0.091929
-0.09311
0.109063
];
>> sim(net,P1)
请在我的基础上改改。。。说说原因,。不要随便发一个给我。。baidu知道上的。。我也能查到。。。解决后还会加分的。。。。谢谢大家了 展开
%输入样本P
P=[0.139991 -0.0925 0.208224 0.035245 -0.15781 0.186609 -0.10978 0.042804 -0.37464 0.571837 -0.18424 0.104407 -0.30953 0.433872;
-0.0925 0.208224 0.035245 -0.15781 0.186609 -0.10978 0.042804 -0.37464 0.571837 -0.18424 0.104407 -0.30953 0.433872 -0.55118;
0.208224 0.035245 -0.15781 0.186609 -0.10978 0.042804 -0.37464 0.571837 -0.18424 0.104407 -0.30953 0.433872 -0.55118 0.254276;
0.035245 -0.15781 0.186609 -0.10978 0.042804 -0.37464 0.571837 -0.18424 0.104407 -0.30953 0.433872 -0.55118 0.254276 0.032833;
-0.15781 0.186609 -0.10978 0.042804 -0.37464 0.571837 -0.18424 0.104407 -0.30953 0.433872 -0.55118 0.254276 0.032833 -0.13925;
0.186609 -0.10978 0.042804 -0.37464 0.571837 -0.18424 0.104407 -0.30953 0.433872 -0.55118 0.254276 0.032833 -0.13925 0.195242;
-0.10978 0.042804 -0.37464 0.571837 -0.18424 0.104407 -0.30953 0.433872 -0.55118 0.254276 0.032833 -0.13925 0.195242 -0.04116;
0.042804 -0.37464 0.571837 -0.18424 0.104407 -0.30953 0.433872 -0.55118 0.254276 0.032833 -0.13925 0.195242 -0.04116 -0.07635;
-0.37464 0.571837 -0.18424 0.104407 -0.30953 0.433872 -0.55118 0.254276 0.032833 -0.13925 0.195242 -0.04116 -0.07635 0.091929;
0.571837 -0.18424 0.104407 -0.30953 0.433872 -0.55118 0.254276 0.032833 -0.13925 0.195242 -0.04116 -0.07635 0.091929 -0.09311];
%目标输出T
T =[-0.18424 0.104407 -0.30953 0.433872 -0.55118 0.254276 0.032833 -0.13925 0.195242 -0.04116 -0.07635 0.091929 -0.09311 0.109063];
>> net=newelm(minmax(P),[9,1],{'tansig','logsig'},'traingdx');
>> net.trainParam.epochs=1000;
net.trainParam.goal=0.01;
LP.lr=0.1;
net=train(net,P,T);
P1=[-0.55118
0.254276
0.032833
-0.13925
0.195242
-0.04116
-0.07635
0.091929
-0.09311
0.109063
];
>> sim(net,P1)
请在我的基础上改改。。。说说原因,。不要随便发一个给我。。baidu知道上的。。我也能查到。。。解决后还会加分的。。。。谢谢大家了 展开
4个回答
展开全部
0.30953 0.433872 -0.55118 0.254276 0.032833;
-0.15781 0.186609 -0.10978 0.042804 -0.37464 0.571837 -0.18424 0.104407 -0.30953 0.433872 -0.55118 0.254276 0.032833 -0.13925;
-0.15781 0.186609 -0.10978 0.042804 -0.37464 0.571837 -0.18424 0.104407 -0.30953 0.433872 -0.55118 0.254276 0.032833 -0.13925;
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
晓网科技
2024-10-17 广告
2024-10-17 广告
ZigBee作为一项新型的无线通信技术,其具有传统网络通信技术所不可比拟的优势,既能够实现近距离操作,又可降低能源的消耗。又如,相较于蓝牙等无线通信技术,ZigBee无线通信技术可有效降低使用成本, 即便数据处理的速率并不高,然而,值得肯定...
点击进入详情页
本回答由晓网科技提供
展开全部
ma d ,好难啊。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
#include<stdio.h>
#include<conio.h>
#define RUN 1
void swap(int *a, int *b)
{
int temp;
temp = *a;
*a = *b;
*b = temp;
}
void change(int *p)
{
int i;
int j;
int *pmax = p, *pmin = p;
for (i = 0 ; i < 5 ; i++)
{
for (j = 0 ; j < 5 ; j++)
{
if (*pmax < *(p + 5*i + j))
{
pmax = (p + 5*i + j);
}
if (*pmin > *(p + 5*i + j))
{
pmin = (p + 5*i + j);
}
}
}
swap(pmin, p);
swap(pmax, (p + 12));
#if RUN
printf("%d %d\n", *p, *(p + 12));
#endif
pmin = (p + 1);
for (i = 0 ; i < 5 ; i++)
{
for (j = 0 ; j < 5 ; j++)
{
if (*pmin > *(p + 5*i + j) && (i != 0 || j != 0))
{
pmin = (p + 5*i + j);
}
}
}
swap(pmin, (p + 4));
#if RUN
printf("%d\n", *(p + 4));
#endif
pmin = (p + 1);
for (i = 0 ; i < 5 ; i++)
{
for (j = 0 ; j < 5 ; j++)
{
if (*pmin > *(p + 5*i + j) && (i != 0 || j != 0) && (i != 0 || j != 4))
{
pmin = (p + 5*i +j);
}
}
}
swap(pmin, (p + 5*4));
#if RUN
printf("%d\n", *(p + 20));
#endif
pmin = (p + 1);
for (i = 0 ; i < 5 ; i++)
{
for (j = 0 ; j < 5 ; j++)
{
if (*pmin > *(p + 5*i + j) && (i != 0 || j != 0) && (i != 4 || j != 0) && (i != 0 || j != 4))
{
pmin = (p + 5*i + j);
}
}
}
swap(pmin, (p + 4*5 + 4));
#if RUN
printf("%d\n", *(p + 24));
#endif
}
main()
{
int a[5][5];
int *p1 = &a[0][0];
int i, j;
printf("input the numbers:\n");
for (i = 0 ; i < 5 ; i++)
{
for (j = 0 ; j < 5 ; j++)
{
scanf("%d", &a[i][j]);
}
}
change(p1);
printf("the new is:\n");
for (i = 0 ; i < 5 ; i++)
{
for (j = 0 ; j < 5 ; j++)
{
printf("%d ", *(p1 + 5*i + j));
}
printf("\n");
}
getch();
}
#include<conio.h>
#define RUN 1
void swap(int *a, int *b)
{
int temp;
temp = *a;
*a = *b;
*b = temp;
}
void change(int *p)
{
int i;
int j;
int *pmax = p, *pmin = p;
for (i = 0 ; i < 5 ; i++)
{
for (j = 0 ; j < 5 ; j++)
{
if (*pmax < *(p + 5*i + j))
{
pmax = (p + 5*i + j);
}
if (*pmin > *(p + 5*i + j))
{
pmin = (p + 5*i + j);
}
}
}
swap(pmin, p);
swap(pmax, (p + 12));
#if RUN
printf("%d %d\n", *p, *(p + 12));
#endif
pmin = (p + 1);
for (i = 0 ; i < 5 ; i++)
{
for (j = 0 ; j < 5 ; j++)
{
if (*pmin > *(p + 5*i + j) && (i != 0 || j != 0))
{
pmin = (p + 5*i + j);
}
}
}
swap(pmin, (p + 4));
#if RUN
printf("%d\n", *(p + 4));
#endif
pmin = (p + 1);
for (i = 0 ; i < 5 ; i++)
{
for (j = 0 ; j < 5 ; j++)
{
if (*pmin > *(p + 5*i + j) && (i != 0 || j != 0) && (i != 0 || j != 4))
{
pmin = (p + 5*i +j);
}
}
}
swap(pmin, (p + 5*4));
#if RUN
printf("%d\n", *(p + 20));
#endif
pmin = (p + 1);
for (i = 0 ; i < 5 ; i++)
{
for (j = 0 ; j < 5 ; j++)
{
if (*pmin > *(p + 5*i + j) && (i != 0 || j != 0) && (i != 4 || j != 0) && (i != 0 || j != 4))
{
pmin = (p + 5*i + j);
}
}
}
swap(pmin, (p + 4*5 + 4));
#if RUN
printf("%d\n", *(p + 24));
#endif
}
main()
{
int a[5][5];
int *p1 = &a[0][0];
int i, j;
printf("input the numbers:\n");
for (i = 0 ; i < 5 ; i++)
{
for (j = 0 ; j < 5 ; j++)
{
scanf("%d", &a[i][j]);
}
}
change(p1);
printf("the new is:\n");
for (i = 0 ; i < 5 ; i++)
{
for (j = 0 ; j < 5 ; j++)
{
printf("%d ", *(p1 + 5*i + j));
}
printf("\n");
}
getch();
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
2年没编了,忘了。。。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询