How do I create a large binary target matrix?
古いコメントを表示
Hello. I have a dataset of 300 samples (with 60 observations each) that are divided into 6 even categories (50 samples each)
For neural networking purposes, I would like to create a target matrix such that:
0-50 = category 1
51-50 = category 2
.
.
.
251-300 = category 6
I plan to assign these values by creating a 6x300 matrix. and placing a 1 in row 1 for 0-50, a 1 in row 2 for 51-100 and so on. I believe I may be able to do this by manipulating the eye function, but I have not seen examples of this. I know there must be an easier way to do this than by logging the numbers manually... any ideas? thanks
採用された回答
その他の回答 (2 件)
Walter Roberson
2017 年 6 月 14 日
編集済み: Walter Roberson
2017 年 6 月 14 日
0 投票
1 件のコメント
Walter Roberson
2017 年 6 月 15 日
kron(eye(6), ones(1,50))
Greg Heath
2017 年 6 月 15 日
The only way to use eye is
target = repmat(eye(6),50)
Otherwise start with
target = zeros(6,300)
then insert ones(1,50) into the correct locations.
Hope this helps.
Thank you for formally accepting my answer
Greg
カテゴリ
ヘルプ センター および File Exchange で Deep Learning Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!