neural network input target data format, Vertical or Horizontal vector within cell array?
6 ビュー (過去 30 日間)
古いコメントを表示
I have a set of vectors measured dx dy on a given set of coordinates over a time period i=1:5;
If I make two neural networks, one for x and one for y, does my input for “error” and “input” (see below example code) have to be vertical or horizontal vector within the cell array?
%%%%%%%%%
example code
%%%%%%%%%
% if I have a set of vertical vectors coordinates with X position defined by Column 1 = cord(:,1) and Y position defines by Column 2 = (cord(:,2))
cord=[-2 -2;-2 -1;-2 0;-2 1;-2 2;-1 -2;-1 -1;-1 0;-1 1;-1 2;0 -2;0 -1;0 0;0 1;0 2; 1 -2;1 -1;1 0;1 1;1 2;2 -2;2 -1;2 0;2 1;2 2];
% I have a set of target vectors per point defined by dx = tmpError(:,1) & dy = tmpError(:,2)
tmpError=[0.3 0.2;0.1 0.2;0.3 0.4;0.1 0.2;0.4 0.5;...
0.1 0.4;0.2 0.1;0.3 0.2;0.1 0.2;0.4 0.5;...
0.2 0.2;0.4 0.4;0.2 0.1;0.3 0.2;0.1 0.5;...
0.4 0.3;0.3 0.3;0.3 0.2;0.2 0.2;0.3 0.5;...
0.3 0.2;0.4 0.2;0.1 0.4;0.4 0.2;0.4 0.5];
for i=1:5
error{i}=tmpError*i;
errorDx{i}=tmpError*i;
errorDy{i}=tmpError*i;
end
% Input would be same dxInput = input(:,1) & dyInput = input(:,2)
tmpInput=[1.3 1.2;1.1 1.2;1.3 1.4;1.1 1.2;1.4 1.5; 2.1 2.4;2.2 2.1;2.3 2.2;2.1 2.2;2.4 2.5; 3.2 3.2;3.4 3.4;3.2 3.1;3.3 3.2;3.1 3.5; 4.4 4.3;4.3 4.3;4.3 4.2;4.2 4.2;4.3 4.5; 5.3 5.2;5.4 5.2;5.1 5.4;5.4 5.2;5.4 5.5];
for i=1:5
input{i}=tmpInput*i;
inputDx{i}=tmpInput(:,1)*i;
inputDy{i}=tmpInput(:,2)*i;
end
%% OR should they be transposed....
cord=cord';
tmpError=tmpError';
for i=1:5
error{i}=tmpError*i;
errorDx{i}=tmpError(1,:)*i;
errorDy{i}=tmpError(2,:)*i;
end
tmpInputDx=repmat(tmpInput(:,1),1,5);
tmpInputDy=repmat(tmpInput(:,2),1,5);
2 件のコメント
Greg Heath
2013 年 2 月 15 日
AAARRRGH ... Please use the ANSWERS formatting rules. See the blocks B,I,Aa,...{} Code and Help above the reply box? Even if you just use 1 indented line per command, it would help immensely. Also try putting braces {} around your code.
Greg
回答 (2 件)
Greg Heath
2013 年 2 月 15 日
It would be helpful to the reader (especially the older ones) if you would use the notation 0.69 instead of just .69.
All inputs and outputs to the NN functions are matrices or cells of column vectors.
For a data set of N I-dimensional input vectors and N corresponding O-dimensional target vectors
[ I N ] = size(input)
[ O N ] = size(target)
or the cell equivalents
Inputs = { inputs };
Targets = { targets };
Hope this helps.
Thank you for formally accepting my answer
Greg
3 件のコメント
Greg Heath
2013 年 2 月 16 日
編集済み: Greg Heath
2013 年 2 月 16 日
In the general case, they are columns. You may be getting fooled by looking at one-dimensional timeseries. Each measurement is a one-dimensional column vector. The fact that you see the total data as a row instead of a sequence of one-dimensional columns is irrelevant.
Hope this helps.
Greg
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!