neural network input target data format, Vertical or Horizontal vector within cell array?
Show older comments
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 Comments
Greg Heath
on 15 Feb 2013
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
Answers (2)
hi, can you explain more your problem ?
1 Comment
Greg Heath
on 15 Feb 2013
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 Comments
Greg Heath
on 15 Feb 2013
What is the purpose of multiplying by i?
When you post code make sure that it will not throw errors when cut and pasted into the command line. For example,
for i=1:5 input{i}=tmpInput*i; end
|
Error: The expression to the left of the equals sign is not
a valid target for an assignment.
You omitted the comma or semicolon after the 5.
Also
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];
Error using vertcat
CAT arguments dimensions are not consistent.
Hope this helps.
Greg
Emil
on 16 Feb 2013
Greg Heath
on 16 Feb 2013
Edited: Greg Heath
on 16 Feb 2013
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
Categories
Find more on Deep Learning Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!