MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   深度神经网络/深度学习 (https://www.labfans.com/bbs/forumdisplay.php?f=45)
-   -   神经网络PNN问题 (https://www.labfans.com/bbs/showthread.php?t=8199)

wsy1351 2009-05-09 17:05

神经网络PNN问题
 
%输入向量P和目标向量T
P=[1.033 0.197 0.185 0.306;
1.045 0.205 0.309 0.354;
1.041 0.194 0.455 0.406;
1.046 0.194 0.587 0.454;
1.061 0.193 0.719 0.504;
1.042 0.367 0.102 0.304;
1.050 0.386 0.249 0.354;
1.064 0.370 0.407 0.406;
1.081 0.361 0.698 0.506;
1.033 0.234 0.743 0.507;
1.062 0.235 0.598 0.454;
1.055 0.242 0.467 0.407;
1.052 0.241 0.318 0.355;
1.047 0.247 0.176 0.305;
1.041 0.250 0.032 0.252;
1.050 0.338 0.126 0.307;
1.060 0.377 0.267 0.355;
1.060 0.340 0.419 0.403;
1.068 0.331 0.561 0.454;
1.026 0.196 0.242 0.354;
1.033 0.181 0.370 0.407;
1.046 0.180 0.487 0.456;
1.053 0.178 0.627 0.508;
1.033 0.362 0.031 0.303;
1.043 0.370 0.171 0.354;
1.050 0.362 0.312 0.406;
1.061 0.367 0.436 0.455;
1.057 0.359 0.572 0.506;
1.068 0.241 0.712 0.517;
1.069 0.248 0.631 0.488;
1.056 0.245 0.503 0.437;
1.049 0.248 0.353 0.382;
1.053 0.249 0.204 0.327;
1.055 0.336 0.157 0.328;
1.057 0.336 0.305 0.379;
1.060 0.341 0.419 0.429;
1.067 0.333 0.600 0.484;
1.075 0.332 0.501 0.516]';
T=[1 0 0;
1 0 0;
1 0 0;
1 0 0;
1 0 0;
1 0 0;
1 0 0;
1 0 0;
1 0 0;
1 0 0;
1 0 0;
1 0 0;
1 0 0;
1 0 0;
1 0 0;
1 0 0;
1 0 0;
1 0 0;
1 0 0;
1 0 0;
0 0 1;
0 0 1;
0 0 1;
0 0 1;
0 0 1;
0 0 1;
0 0 1;
0 0 1;
0 0 1;
0 1 0;
0 1 0;
0 1 0;
0 1 0;
0 1 0;
0 1 0;
0 1 0;
0 1 0;
0 1 0;
0 1 0]';
%创建4个PNN,SPREAD不同
for i=1:4
net=newpnn(P,T,i/8);
temp=sim(net,P)
yc=vec2ind(temp)
end
%测试样本
P_test=[1.020 0.190 0.052 0.255;
1.085 0.330 0.701 0.502;
1.028 0.184 0.122 0.306;
1.044 0.251 0.053 0.273]';
y_test=sim(net,P_test);
yc_test=vec2ind(y_test);
yc_test
谁能告诉我为什么会
Error in ==> PNN1 at 81
net=newpnn(P,T,i/8);

karl_wang 2009-05-09 20:51

回复: 神经网络PNN问题
 
%输入向量P和目标向量T
P=[1.033 0.197 0.185 0.306;
1.045 0.205 0.309 0.354;
1.041 0.194 0.455 0.406;
1.046 0.194 0.587 0.454;
1.061 0.193 0.719 0.504;
1.042 0.367 0.102 0.304;
1.050 0.386 0.249 0.354;
1.064 0.370 0.407 0.406;
1.081 0.361 0.698 0.506;
1.033 0.234 0.743 0.507;
1.062 0.235 0.598 0.454;
1.055 0.242 0.467 0.407;
1.052 0.241 0.318 0.355;
1.047 0.247 0.176 0.305;
1.041 0.250 0.032 0.252;
1.050 0.338 0.126 0.307;
1.060 0.377 0.267 0.355;
1.060 0.340 0.419 0.403;
1.068 0.331 0.561 0.454;
1.026 0.196 0.242 0.354;
1.033 0.181 0.370 0.407;
1.046 0.180 0.487 0.456;
1.053 0.178 0.627 0.508;
1.033 0.362 0.031 0.303;
1.043 0.370 0.171 0.354;
1.050 0.362 0.312 0.406;
1.061 0.367 0.436 0.455;
1.057 0.359 0.572 0.506;
1.068 0.241 0.712 0.517;
1.069 0.248 0.631 0.488;
1.056 0.245 0.503 0.437;
1.049 0.248 0.353 0.382;
1.053 0.249 0.204 0.327;
1.055 0.336 0.157 0.328;
1.057 0.336 0.305 0.379;
1.060 0.341 0.419 0.429;
1.067 0.333 0.600 0.484;
1.075 0.332 0.501 0.516]';
T=[1 0 0;
1 0 0;
1 0 0;
1 0 0;
1 0 0;
1 0 0;
1 0 0;
1 0 0;
1 0 0;
1 0 0;
1 0 0;
1 0 0;
1 0 0;
1 0 0;
1 0 0;
1 0 0;
1 0 0;
1 0 0;
1 0 0;
1 0 0;
0 0 1;
0 0 1;
0 0 1;
0 0 1;
0 0 1;
0 0 1;
0 0 1;
0 0 1;
0 0 1;
0 1 0;
0 1 0;
0 1 0;
0 1 0;
0 1 0;
0 1 0;
0 1 0;
0 1 0;
0 1 0]';
%创建4个PNN,SPREAD不同
for i=1:4
net=newpnn(P,T,i/8);
temp=sim(net,P);
yc=vec2ind(temp)
end
%测试样本
P_test=[1.020 0.190 0.052 0.255;
1.085 0.330 0.701 0.502;
1.028 0.184 0.122 0.306;
1.044 0.251 0.053 0.273]';
y_test=sim(net,P_test);
yc_test=vec2ind(y_test);
yc_test
你再运行下,可以出结果!

wsy1351 2009-05-10 07:44

回复: 神经网络PNN问题
 
还是不行啊。。。它显示??? Error using ==> newpnn
Inputs and Targets have different numbers of columns.

Error in ==> PNN1 at 81
net=newpnn(P,T,i/8);
这和MATLAB版本有关系吗?我的是7.0的

xyxcz 2009-05-10 22:26

回复: 神经网络PNN问题
 
yc =

Columns 1 through 11

1 1 1 1 1 1 1 1 1 1 1

Columns 12 through 22

1 1 1 1 1 1 1 1 1 1 1

Columns 23 through 33

1 1 1 1 1 1 1 1 1 1 1

Columns 34 through 38

1 1 1 1 2


yc =

Columns 1 through 11

1 1 1 1 1 1 1 1 1 1 1

Columns 12 through 22

1 1 1 1 1 1 1 1 1 1 1

Columns 23 through 33

1 1 1 1 1 1 1 1 1 1 1

Columns 34 through 38

1 1 1 1 1


yc =

Columns 1 through 11

1 1 1 1 1 1 1 1 1 1 1

Columns 12 through 22

1 1 1 1 1 1 1 1 1 1 1

Columns 23 through 33

1 1 1 1 1 1 1 1 1 1 1

Columns 34 through 38

1 1 1 1 1


yc =

Columns 1 through 11

1 1 1 1 1 1 1 1 1 1 1

Columns 12 through 22

1 1 1 1 1 1 1 1 1 1 1

Columns 23 through 33

1 1 1 1 1 1 1 1 1 1 1

Columns 34 through 38

1 1 1 1 1


yc_test =

1 1 1 1

我也是7.0版本

karl_wang 2009-05-11 20:27

回复: 神经网络PNN问题
 
[QUOTE=wsy1351;27534]还是不行啊。。。它显示??? Error using ==> newpnn
Inputs and Targets have different numbers of columns.

Error in ==> PNN1 at 81
net=newpnn(P,T,i/8);
这和MATLAB版本有关系吗?我的是7.0的[/QUOTE]

我的可以运行,没有问题!我的是7.1版本!

ashhell 2009-06-08 15:42

回复: 神经网络PNN问题
 
回复2楼



我用MATLAB7.6 即2008a,运行结果如下

>> yc_test

yc_test =

1 1 1 1


是不是不正确?

karl_wang 2009-06-09 11:40

回复: 神经网络PNN问题
 
没有问题。你可以查询下vec2ind的用法。


所有时间均为北京时间。现在的时间是 05:02

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.