How do I define a neural network target matrix in this situation?

3 views (last 30 days)
My input data is a 100 x 200 matrix. The 100 rows represent different subjects and the 200 columns are data points for different times (1 min, 2 min, etc). The data is such that the item which I am measuring changes over time, so for every subject/trial there are 200 different values for 200 time points.
My output would be either a 1 or a 0, meaning a yes or a no. I am trying to create a neural network that predicts whether or not the result for one subject (1 row) would be a 1 or a 0, and I am having trouble defining the target matrix. Here is what I have so far:
% 1.1 means subject 1, data point 1, etc. This is a 100 x 200 matrix
input = [1.1 1.2 1.3 1.4...; 2.1 2.2 2.3 2.4... ;...];
% This is a 100 x 1 matrix of what actually results from each row of the input matrix; meaning that 1.1 1.2 1.3 etc are values that correspond to the first 1 in the target matrix.
target = [1 0 1 0 1 0 0 0 1 ...]'
I assumed that the target matrix should be vertical (100 x 1) so I added a ' to transpose it. However, when trying to create the neural network I am presented with an error that says the dimensions of the matrices are not the same. I know that the dimensions are not the same, but they are not supposed to be because 1 x 200 of the input matrix correspond to just one column of the target matrix.
  1 Comment
Rik
Rik on 25 Aug 2020
@Akshar Agarwal regarding your flag ("Please delete this question. I posted it a long time ago and it is very silly and I dont want it to come up on google search"):
Also very silly questions can be very useful. You have to start somewhere if you're new to a topic. Removing this question migth cause this same question to be asked again, which would mean Stephen would have to answer it again. This is of course a waste of everybody's time, which is why we tend to only delete questions under very rare circumstances (or if there is a duplicate question).

Sign in to comment.

Accepted Answer

Stephen Jue
Stephen Jue on 23 Jun 2017
Hi,
I believe your input data should be 200 x 100 and your target data should be 1 x 100.
In general, the second dimension of your input data and target data should always match. You can see this by example by loading one of the sample classification datasets, iris_dastaset:
load iris_dataset
This loads irisInputs (4 x 150) and irisTargets (3 x 150).

More Answers (0)

Categories

Find more on Sequence and Numeric Feature Data Workflows in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!