Getting Target Data from Given Input Matrix Neural Networks
1 view (last 30 days)
Show older comments
I am given an input data matrix representing emails. Each row corresponds to one email and the columns correspond to attributes of that email as numeral values. The last column is my target column, which classifies whether or not the E-Mail is a spam using 0 (not spam) and 1 (spam).
I now want to create and train a neural network to identify whether an email is spam or not based on this last column using the Neural Networks Toolbox. How to I create the target data from my file?
I am pretty confused about how to create files in matlab in general, so a detailed description would be appreciated.
Thanks!
0 Comments
Answers (1)
Greg Heath
on 15 Sep 2016
N pairs of I-dimensional "I"nput vectors and corresponding O-dimensional "O"utput target vectors stored in matrices input and target:
[ I N [ = size(input)
[ O N ] = size(target)
output = net(input);
[ O N ] = size(output)
Hope this helps
Thank you for formally accepting my answer
Greg
2 Comments
Greg Heath
on 19 Sep 2016
That is not a complete code.
The first two explicitly tell you the size of your data matrices so that you can verify that you have not accidently transposed a matrix or otherwise made a mistake.
The next is a post training command that yields the output y from a TRAINED net.
The last is not typically in codes. I just wanted to emphasize that the output is the same size as the target.
To see a full classification codes that include training, see the documentation examples via the commands
help patternnet
doc patternnet
To see more practical classification codes search both the NEWSGROUP and ANSWERS using
greg patternnet
To obtain more MATLAB data for practice use the commands
help nndatasets
doc nndatasets
Hope this helps
Greg
See Also
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!