how to create a target set for ANN classification???
3 ビュー (過去 30 日間)
古いコメントを表示
i am trying to create a target set for my inputs to be used in classification with ANN but i have some challenges . i have 23 classes of images of which each class contains 100 images. feature extraction was done and i got a matrix of 2300*20736. how can i create a target set for my inputs.
0 件のコメント
採用された回答
Baptiste Ottino
2017 年 8 月 14 日
Your target set must have one label for each sample, so it must contains 2300 elements. Here is an easy way to build one. Start by numbering your classes from 1 to 23. Make sure that your X Array is sorted by class, meaning all the samples from the first class, then all the samples from the second class, and so on. Then:
% Classes from 1 to 23
y = 1:23;
% 100 samples per class
y = repmat(y, 100, 1);
% Reshape to obtain a vector
y = reshape(y, 1, numel(y));
At this stage, you should have a 1-by-2300 vector with numeric class labels from 1 to 23. This is what you want if you use the Statistics and Machine Learning tToolbox.
Now, I suppose you intend to use the Neural Network Toolbox. In that case the syntax is a bit different: the class labels are in a 23-by-2300 matrix, each column being a sample, with the row corresponding to the class getting value '1' and the rest '0'. To build it from the previous syntax, type:
y = full(ind2vec(y));
Good luck!
3 件のコメント
shivasmic
2019 年 6 月 24 日
Baptiste ottino, thanx for the method, the method that you suggest for the comnstruction of target vector leads to the creation of matrix which has dimensions of 23 x 2300 but the input vector has dimension of 2300 x 20736.
Dont you think that the dimension of target vector should also be 2300 x 23.
I am asking this as I am also facing the same problem. Kindly clarify this as soon as possible!
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Image Data Workflows についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!